Challenge 1
Write the call that uses box as this.
function read() { return this.value; }
const box = { value: 7 };
const result = read.(box);
Press Ctrl⌘Enter to check your answer
Practice function objects, call-site this, arrow functions, call/apply/bind, and constructor calls by completing real JavaScript.
Challenge 1
function read() { return this.value; }
const box = { value: 7 };
const result = read.(box);
Press Ctrl⌘Enter to check your answer
Challenge 2
function add(a, b) { return this.base + a + b; }
const result = add.apply({ base: 10 }, );
Press Ctrl⌘Enter to check your answer
Challenge 3
function read() { return this.value; }
const fixed = read.({ value: 9 });
console.log(fixed());
Press Ctrl⌘Enter to check your answer
Challenge 4
const panel = { label: "Foxipa", make() { return ; } };
Press Ctrl⌘Enter to check your answer
Challenge 5
function User(name) {
}
const user = new User("Ada");
Press Ctrl⌘Enter to check your answer
Challenge 6
const box = { value: 4, read() { return this.value; } };
const result = ;
Press Ctrl⌘Enter to check your answer
Challenge 7
const box = { value: 12, read() { return this.value; } };
const read = box.read;
const fixed = read.(box);
Press Ctrl⌘Enter to check your answer
Challenge 8
function run(task) { return task(); }
function value() { return 7; }
const result = run();
Press Ctrl⌘Enter to check your answer