Microsoft
98-382 · Question #34
You need to evaluate the following code segment. Line numbers are included for reference only. ``javascript 01 var n; 02 console.log(typeof n); 03 var a = "3.4"; 04 console.log(typeof a); 05 var…
Evaluate the output of console.log for each specified line: What does the console.log function on line 02 write to the console? Answer: undefined What does the console.log function on line 04 write to the console? Answer: string What does the console.log function on line 06…
Variables, Data Types, and Functions
Question
You need to evaluate the following code segment. Line numbers are included for reference only.
01 var n;
02 console.log(typeof n);
03 var a = "3.4";
04 console.log(typeof a);
05 var textArray = ["Welcome Back", "Enter a Name", "Incorrect Answer"];
06 console.log(typeof textArray);
07 var c = 2.4;
08 console.log(typeof c);
09 var tag = null;
10 console.log(typeof tag);
Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.Explanation
Evaluate the output of console.log for each specified line:
- What does the console.log function on line 02 write to the console? Answer: undefined
- What does the console.log function on line 04 write to the console? Answer: string
- What does the console.log function on line 06 write to the console? Answer: object
- What does the console.log function on line 08 write to the console? Answer: number
- What does the console.log function on line 10 write to the console? Answer: object
Topics
#typeof operator#data types#undefined#null
Community Discussion
No community discussion yet for this question.