Arrow Function in JavaScript
Level 378 keystrokes
This defines an arrow function that adds two numbers and calls it twice.
JavaScript code
// Arrow function with the parameters (a, b)// The expression after => (a + b) is returned automatically1const add = (a, b) => a + b;// Call with 3 and 5, returns 82console.log(add(3, 5));// Call with 10 and 20, returns 303console.log(add(10, 20));Output
8 30
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
(× 5)× 5,× 3;× 3.× 2=× 2+× 1>× 1