SyntaxError
JavaScript could not read your code. This usually means a missing or extra bracket, quote, comma or parenthesis.
Quick fix: Check that every ( { [ has a matching ) } ].
Interview preparation
Write JavaScript, run it in your browser and watch every test pass or fail. If something breaks, we explain why it happened and what to study next.
Arrays, strings, hash maps and stacks, the basics of every coding round.
Return the sum of all numbers in the array. An empty array should return 0.
Tip: press Ctrl or Cmd + Enter to run. Your code is saved in this browser.
Press “Run tests” to check your solution.
Every coding task you solve earns a badge. Finish a whole track to unlock a certificate. Sign in to collect them and see them on your profile.
0 of 23 task badges collected
First solve
Solve any problem
On a roll
Solve 5 problems
Double digits
Solve 10 problems
Easy sweep
Solve every Easy problem
Software Development master
Solve every Software Development problem
Data Analyst master
Solve every Data Analyst problem
Cyber Security master
Solve every Cyber Security problem
Most beginners meet the same four errors again and again. Knowing what each one means makes debugging much faster in interviews and on the job.
JavaScript could not read your code. This usually means a missing or extra bracket, quote, comma or parenthesis.
Quick fix: Check that every ( { [ has a matching ) } ].
You used something that does not exist in this scope. Common causes are a typo, a missing let/const, or using a variable outside the block where it was created.
Quick fix: Declare variables with let or const before using them.
An operation was used on the wrong type of value. For example calling .map on something that is not an array, or reading a property of undefined.
Quick fix: Print the value with console.log to see what it really is.
A function kept calling itself and never stopped, so JavaScript ran out of memory for calls (stack overflow).
Quick fix: Add a base case: a condition that returns without calling the function again.