Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 670 Bytes

File metadata and controls

28 lines (18 loc) · 670 Bytes

Code comprehension

Remember to preview a markdown file on your computer you can do: Ctrl + Shift + V (Windows/Linux) or CMD + Shift + V (Mac)

Consider the code in this program below:

function calculateSum(a, b) {
  return a + b;
}

function logSum(a, b) {
  console.log(a + b);
}

const result1 = calculateSum(10, 32);
const result2 = logSum(10, 32);

a) what will result1 evaluate to? If I call function: I have 42

b) What will result2 evaluate to? Explain your answer : I have 42

c) Try to summarise the main difference between logSum and calculateSum They have same result however logSum() executes in the terminal

{YOUR ANSWERS HERE}