Execution Order Tasks

Example

Calculate the execution order of:

(_.sum takes an array and sums all the numbers in the array e.g. _.sum([1,2,3]) === 6)

_.sum([1, 1 + 2, 0, [1, 2, 3].length])

Answer:

_.sum([1, 1 + 2, 0, [1, 2, 3].length])

_.sum([1, 3, 0, [1, 2, 3].length])

_.sum([1, 3, 0, 3])

7

If you get stuck. Use the Chrome console to run the code and test things out.

Question 1:

Calculate the execution order of:

[1, 2, 3, 4 + 5].length

Question 2:

Calculate the execution order of:

'hello'.substring(0, 3).length

Question 3:

Calculate the execution order of:

'hello'.substring(0, 3 - 1).length + 'world'

Question 4:

Calculate the execution order of:

{
  hello: 'wor' + 'ld'
}

Answers:

Here are the answers to the questions. Try your best to do it on your own! If you have questions - ask on Discord.