Choose the correct optionfunction add(a,b){ 'use strict' c=10; return (a+b+c); } console.log(add(3,4))Options: Pick one correct answer from below177ReferenceError: c is not defined
Question
Choose the correct optionfunction add(a,b){ 'use strict' c=10; return (a+b+c); } console.log(add(3,4))Options: Pick one correct answer from below177ReferenceError: c is not defined
Solution
The correct answer is "ReferenceError: c is not defined".
This is because in 'strict mode', you cannot use a variable without declaring it first. In the given function, variable 'c' is used without being declared, hence it will throw a ReferenceError.
Similar Questions
FunctionsWhat does the error, invalid re-declaration of a function mean?OptionsThere is no declaration in scopeThere are multiple declarationsFunction is invalidNone of the above
Select the correct answerPredict the output of the given code snippet#include<stdio.h>void Function(int s, ...) { printf("%d ", s);} int main() { Function(1, 2, 3, 4); Function(5, 6, 7); Function(8, 9); return 0;}Options1 2 3 4 5 6 7 8 91 5 84 7 9Error
Which of the following is the correct way to call an “add” function with arguments 5 and 10 in C?add(10, 5);add(5, 10);add( 5 & 10);add(int 5, int 10);int add(5, 10);
A function must be called to be of any useGroup of answer choicesTrueFalse
What is the output of the add() function calldef add(a, b): return a+5, b+5result = add(3, 2)print(result)158(8, 7)Syntax Error
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.