Functions & Procedures in JavaScript (OCR A-Level Computer Science): Quizzes
📚Quizzes
Practise the questions
10 questions from this quiz
ShowHide
Practise the questions
10 questions from this quiz
What do functions and procedures in JavaScript encapsulate?
What do functions and procedures in JavaScript encapsulate?
Reusable code
What is the main difference between functions and procedures in JavaScript?
What is the main difference between functions and procedures in JavaScript?
Functions return outputs; procedures execute
Which syntax correctly defines a function in JavaScript?
Which syntax correctly defines a function in JavaScript?
function myFunction() { }
What can functions accept as inputs?
What can functions accept as inputs?
Parameters
What keyword is used to send results back from a function?
What keyword is used to send results back from a function?
return
What does console.log(add(5, 3)) output if add returns a + b?
What does console.log(add(5, 3)) output if add returns a + b?
8
What will a function return if it doesn't use the return keyword?
What will a function return if it doesn't use the return keyword?
undefined
Why are functions central to JavaScript programming?
Why are functions central to JavaScript programming?
Code reusability
In the example, what does the add function return?
In the example, what does the add function return?
a + b
What is a common mistake when writing functions?
What is a common mistake when writing functions?
Not using return in functions
