GitHub Repository Submission

When using GitHub mode, paste your repository URL below and click Save URL to store it. The saved URL will be automatically included with every message you send until you choose to clear it. Learn more

Your GitHub repository URL is saved. LSBot will automatically fetch your latest code from this repository for each message. To change the URL, clear it first and save a new one.

Exercise 10

How many primitive values are there in the following expression? Identify them. How many objects are there in the expression? Identify those objects.

[1, 2, ["a", ["b", false]], null, {}]

Solution

There are 6 primitive values and 4 objects:

Primitive Values Objects
1 [1, 2, ["a", ["b", false]], null, {}]
2 ["a", ["b", false]]
"a" ["b", false]
"b" {}
false
null

The outermost set of brackets defines an array (an object) that contains 5 elements. The elements with values 1, 2, and null are all primitive values, while ["a", ["b", false]] is a nested array, and {} is nested object. The nested array has 2 elements, one of which is a primitive value ("a"), while the other is yet another nested array. Finally, this innermost array contains two elements, "b" and false, both of which are primitive values.

Video Walkthrough

Hi! I'm LSBot. I can help you think through the selected exercise by giving you hints and guidance without revealing the solution. Your code from the editor will be automatically detected. Want to know more? Refer to the LSBot User Guide .

Detected solution
Loading...

Submit your solution for LSBot review.

Hi! I'm LSBot. Your code from the editor will be automatically detected. I'll review your solution and provide feedback to help you improve. Ask questions about your solution or request a comprehensive code review. Want to know more? Refer to the LSBot User Guide .

Detected solution
Loading...