0
Challenge · 12Just Enough JavaScript

Functions and arrow functions

JavaScriptused in ~95% of apps

Every problem you are given hands you an empty function to fill in. You should be completely comfortable with what that shape means before you are asked to fill one in under time pressure.

Core idea. A function is a named piece of work. You hand it values, it does something, and it hands one thing back with return. Nothing after a return runs.
Playground, this isn't a screenshot
the shape you will be handed
function twoSum(nums, target) {
  return [0, 1];
}
function

the keyword that starts one

twoSum

the name the judge calls

(nums, target)

the values handed in

return

the one thing handed back

Do not rename it. Something you cannot see calls it by exactly that name.

↑ play a little first, then dig in