Thuộc tính toàn cầu
0 đại diện cho giá trị nguyên thủy let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0. Đây là một trong những loại nguyên thủy của JavaScript.let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0 property represents the primitive value let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0. It is one of JavaScript's primitive types. let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0 property represents the primitive value let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0. It is one of JavaScript's primitive types. let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
Nội dung chính ShowShow
- Sự mô tả
- Bình đẳng nghiêm ngặt và không xác định
- Toán tử loại và không xác định
- Void Toán tử và không xác định
- Thông số kỹ thuật
- Tính tương thích của trình duyệt web
- Tại sao chúng ta sử dụng không xác định?
- Có nghĩa là 0 JavaScript không?
- Điều gì xảy ra khi bạn thêm không xác định?
- Không được xác định == null?
Thử nó
Cú pháp
Sự mô tả
Bình đẳng nghiêm ngặt và không xác định
Toán tử loại và không xác định
Void Toán tử và không xác định
let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
5.Thông số kỹ thuật While you can use
let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0 as an identifier [variable name] in any scope other than the global scope [because let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0 is not a reserved word], doing so is a very bad idea that will make your code difficult to maintain and debug.// DON'T DO THIS
[[] => {
const undefined = "foo";
console.log[undefined, typeof undefined]; // foo string
}][];
[[undefined] => {
console.log[undefined, typeof undefined]; // foo string
}]["foo"];
Tính tương thích của trình duyệt web
Bình đẳng nghiêm ngặt và không xác định
Toán tử loại và không xác định
Void Toán tử và không xác địnhThông số kỹ thuật
Tính tương thích của trình duyệt web1 cũng kiểm tra xemlet x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
9 có phải là let x;
if [typeof x === "undefined"] {
// these statements execute
}
3 hay không, trong khi bình đẳng nghiêm ngặt
không. Điều này là do let x;
if [typeof x === "undefined"] {
// these statements execute
}
3 không tương đương với let x;
if [x === undefined] {
// these statements execute
} else {
// these statements do not execute
}
0. The strict equality operator [as opposed to the standard equality operator] must be used here, because Có nghĩa là 0 JavaScript không?
Toán tử loại và không xác định
Void Toán tử và không xác định
Thông số kỹ thuậtTính tương thích của trình duyệt web
Tại sao chúng ta sử dụng không xác định?Có nghĩa là 0 JavaScript không?
Điều gì xảy ra khi bạn thêm không xác định?
// DON'T DO THIS
[[] => {
const undefined = "foo";
console.log[undefined, typeof undefined]; // foo string
}][];
[[undefined] => {
console.log[undefined, typeof undefined]; // foo string
}]["foo"];
7Void Toán tử và không xác định
Thông số kỹ thuật
Tính tương thích của trình duyệt webThông số kỹ thuật
Tại sao chúng ta sử dụng không xác định? # sec-undefined |
Tính tương thích của trình duyệt web
Tại sao chúng ta sử dụng không xác định?
Có nghĩa là 0 JavaScript không?
Tại sao chúng ta sử dụng không xác định?
Có nghĩa là 0 JavaScript không?. A null value has a defined reference to "nothing". If you are calling a non-existing property of an object, then you will get undefined . If I would make that property intentionally empty, then it must be null so you know that it's on purpose.
Có nghĩa là 0 JavaScript không?
Điều gì xảy ra khi bạn thêm không xác định?. undefined typically means a variable has been declared but not defined yet. null and undefined are falsy values.
Điều gì xảy ra khi bạn thêm không xác định?
Không được xác định == null?results in NaN [not-a-number], which won't get you anywhere.
Không được xác định == null?
Nó có nghĩa là NULL bằng với không xác định nhưng không giống nhau.Khi chúng tôi xác định một biến để không xác định thì chúng tôi đang cố gắng truyền đạt rằng biến không tồn tại.Khi chúng tôi xác định một biến thành NULL thì chúng tôi đang cố gắng truyền đạt rằng biến trống.null is equal to undefined but not identical. When we define a variable to undefined then we are trying to convey that the variable does not exist . When we define a variable to null then we are trying to convey that the variable is empty.null is equal to undefined but not identical. When we define a variable to undefined then we are trying to convey that the variable does not exist . When we define a variable to null then we are trying to convey that the variable is empty.