Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Arrow Functions worksheet is part of the JavaScript Coding without HTML and CSS journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1(a, b) => a + b | ADoubles x using a single-parameter arrow function | |
| 2x => x * 2 | BAdds a and b together using an arrow function | |
| 3A shorter way of writing a function expression | CWrong - use =>, not ->, between parameters and body | |
| 4Required even when an arrow function has no parameters | DWrong - arrow functions don't use the 'function' keyword | |
| 5let f = (a, b) -> a + b; | E=> | |
| 6let g = function (x) => x; | F() |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
=> — A shorter syntax for writing a function, placed between the parameters and the function body.let add = (a, b) => {let double = x => x * 2;let greet = () => "Hi";let square = (n) => n * n;let multiply = (x, y) => x * y;