Given the following code:
```javascript
var data;
```
What is the value of `data` when the code runs?
Suggested Answer: A
Get Premium WGU (KVO1) Web Development Applications Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
> ''In JavaScript, any variable declared but not assigned a value is automatically set to `undefined`.''
Example:
```javascript
var data;
console.log(data); // undefined
```
* MDN Web Docs: undefined
* JavaScript Guide: Variables
---
12 comments · newest first
PR
Precious
3 months ago
I’m leaning towards A) Undefined too. Null would mean it was explicitly set.
TR
Trina
3 months ago
Agreed! A) Undefined makes sense. It's the default state.
VI
Vivan
3 months ago
I think the answer is A) Undefined. It hasn't been assigned a value yet.
AR
Arthur
3 months ago
An empty string? Nah, that's not it!
VO
Vonda
3 months ago
Null would be a better guess, right?
MO
Mollie
4 months ago
Wait, how can it be undefined?
LA
Lashandra
5 months ago
Totally agree, it's definitely undefined.
VA
Van
5 months ago
It's undefined!
TY
Tyra
6 months ago
I was confused about null and undefined, but I believe undefined is correct here.
JO
Johnathon
6 months ago
This reminds me of a practice question where an uninitialized variable was also undefined. I think that's the right answer.
BA
Barrett
6 months ago
I'm not entirely sure, but I remember something about variables in JavaScript defaulting to undefined.
CH
Chandra
6 months ago
I think the value of `data` should be undefined since it's declared but not initialized.