Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary - CGS3066: Web Programming and Design Summer 2014

Rating
-
Sold
-
Pages
490
Uploaded on
08-07-2024
Written in
2023/2024

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

Show more Read less
Institution
CGS3066: Web Programming And Design Summer 2014
Course
CGS3066: Web Programming and Design Summer 2014











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CGS3066: Web Programming and Design Summer 2014
Course
CGS3066: Web Programming and Design Summer 2014

Document information

Uploaded on
July 8, 2024
Number of pages
490
Written in
2023/2024
Type
SUMMARY

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
leonardkinyua

Get to know the seller

Seller avatar
leonardkinyua Abraham Lincoln University, School Of Law
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
323
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions