Week 1
Quiz 2

Quiz 2: Multi-argument functions and referencing functions

Question 1

Shows 2 ?
JavaScript
function one(x) {
    return x;
}
function two(x, y) {
    return x + y;
}
function three(x, y, z) {
    return x + y + z;
}
 
const functions = [null, one, two, three];
 
document.writeln(functions[2](1,1,1));

Question 2

Shows 3 ?
JavaScript
function one(x) {
    return x;
}
function two(x, y) {
    return x + y;
}
function three(x, y, z) {
    return x + y + z;
}
 
const functions = [null, one, two, three];
 
document.writeln(functions[3](1,1));

Question 3

Shows 1 ?
JavaScript
function one(x) {
    return x;
}
function two(x, y) {
    return x + y;
}
function three(x, y, z) {
    return x + y + z;
}
 
const functions = [null, one, two, three];
 
document.writeln(functions[1](1));