Consider the following two compounds made of different elements - sodium chloride (NaCl) and carbon dioxide (CO2). For each compound, state which type of bond exist between the elements and explain how the bond works.