

Undefined, null, NaN
Presentation
•
Other
•
KG - University
•
Practice Problem
•
Easy
Eric Foster
Used 1+ times
FREE Resource
3 Slides • 3 Questions
1
Open Ended
Write code that results in "undefined" in the console. Include a console.log()
2
// Variable declared but not assigned
let username;
console.log(username); // Output: undefined
// Missing function parameter
function greet(name) {
console.log(name);
}
greet();// Output: undefined
Undefined
3
Open Ended
Write code that results in "NaN" in the console. Include a console.log()
4
// Programmer sets value to null on purpose
let profilePicture = null; // User hasn't uploaded a picture yet
console.log(profilePicture); // Output: null
// Resetting a value
let score = 100;
score = null; // Intentionally clearing the score
console.log(score);// Output: null
null
5
Open Ended
Write code that uses "null." Include a console.log()
6
// Trying to convert text to a number
let age = Number("twenty");
console.log(age); // Output: NaN
// Math with values that aren't numbers
let result = "hello" * 5;
console.log(result); // Output: NaN
// Parsing fails
let value = parseInt("abc");
console.log(value);// Output: NaN
NaN
Write code that results in "undefined" in the console. Include a console.log()
Show answer
Auto Play
Slide 1 / 6
OPEN ENDED
Similar Resources on Wayground
7 questions
Tirinha
Presentation
•
6th Grade
6 questions
FILIPINO 4 Q1W4
Presentation
•
4th Grade
6 questions
Konseptong Pangwika (Rehistro/Barayti ng Wika, Lingguwistiko
Presentation
•
11th Grade
6 questions
Concordância Verbal
Presentation
•
6th Grade
3 questions
Pharmacy Law
Presentation
•
University
3 questions
economia
Presentation
•
5th - 12th Grade
3 questions
Paglalayag sa puso ng isang bata (simbolo)
Presentation
•
8th Grade
6 questions
Pagbabalik-aral Florante at Laura
Presentation
•
8th Grade
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Assessment 1
Quiz
•
3rd Grade
15 questions
HCS SCI 05 Summer School Assessment 1 Review
Quiz
•
5th Grade
22 questions
Day 9 Equations and Inequalities Review
Quiz
•
9th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
7 questions
PYRAMID PERSPECTIVES part 1
Presentation
•
9th - 12th Grade
12 questions
Understanding the Fourth of July
Quiz
•
9th Grade
15 questions
Soccer World Cup Quiz Questions
Quiz
•
7th Grade
Discover more resources for Other
10 questions
HCS SCI 03 Summer School Assessment 1
Quiz
•
3rd Grade
15 questions
HCS SCI 05 Summer School Assessment 1 Review
Quiz
•
5th Grade
22 questions
Day 9 Equations and Inequalities Review
Quiz
•
9th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
7 questions
PYRAMID PERSPECTIVES part 1
Presentation
•
9th - 12th Grade
12 questions
Understanding the Fourth of July
Quiz
•
9th Grade
15 questions
Soccer World Cup Quiz Questions
Quiz
•
7th Grade