Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 4 fuera de 490 páginas
Resumen

Summary - CGS3066: Web Programming and Design Summer 2014

Document preview thumbnail
Vista previa 4 fuera de 490 páginas

ull is used for representing the intentional absence of an object value and is a primitive value. Unlike undefined, it is not a property of the global object. It is equal to undefined but not identical to it. null == undefined; // true null === undefined; // false CAREFUL: The typeof null is 'object'. typeof null; // 'object'; To properly check if a value is null, compare it with the strict equality operator var a = null; a === null; // true Section 3.2: Testing for NaN using isNaN() NaN() The global function isNaN() can be used to check if a certain value or expression evaluates to NaN. This function (in short) first checks if the value is a number, if not tries to convert it (*), and then checks if the resulting value is NaN. For this reason, this testing method may cause confusion. (*) The "conversion" method is not that simple, see ECMA-262 18.2.3 for a detailed explanation of the algorithm. These examples will help you better understand the isNaN() behavior: isNaN(NaN); // true isNaN(1); // false: 1 is a number isNaN(-2e-4); // false: -2e-4 is a number (-0.0002) in scientific notation isNaN(Infinity); // false: Infinity is a number isNaN(true); // false: converted to 1, which is a number isNaN(false); // false: converted to 0, which is a number isNaN(null); // false: converted to 0, which is a number isNaN(""); // false: converted to 0, which is a number isNaN(" "); // false: converted to 0, which is a number isNaN("45.3"); // false: string representing a number, converted to 45.3 isNaN("1.2e3"); // false: string representing a number, converted to 1.2e3 isNaN("Infinity"); // false: string representing a number, converted to Infinity isNaN(new Date); // false: Date object, converted to milliseconds since epoch isNaN("10$"); // true : conversion fails, the dollar sign is not a digit isNaN("hello"); // true : conversion fails, no digits at all isNaN(undefined); // true : converted to NaN isNaN(); // true : converted to NaN (implicitly undefined) isNaN(function(){}); // true : conversion fails isNaN({}); // true : conversion fails isNaN([1, 2]); // true : converted to "1, 2", which can't be converted to a number This last one is a bit tricky: checking if an Array is NaN. To do this, the Number() constructor first converts the array GoalK – JavaScript® Notes for Professionals 13 to a string, then to a number; this is the reason why isNaN([]) and isNaN([3


Información del documento

Subido en
8 de julio de 2024
Número de páginas
490
Escrito en
2023/2024
Tipo
Resumen
$8.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
322
Última venta
-


Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes

Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.