Yogesh Chauhan's Blog

Values and Types Basics in JavaScript

in JavaScript on February 27, 2020

Numbers

We can write down numbers with or without decimals. For e.g. var x = 3.14 , var y = 3

To write down extra large or extra small numbers, we need to use exponent notation. For e.g. var x = 123e5 , var y = 123e-5

Unique Numbers

There are “special numeric values” which also called Unique Numbers. For e.g. Infinity, -Infinity and NaN. Infinity represents the mathematical Infinity ∞. It is greater than any number.

NaN

NaN actually is a computational error. It is a result of an incorrect or an undefined mathematical operation. The NaN property represents "Not-a-Number" value which indicates that a value is not a legal number. NaN compares unequal (via ==, !=, ===, and !==) to any other value — including to another NaN value.

To write down extra large or extra small numbers, we need to use exponent notation. For e.g. NaN === NaN; will output "false", isNaN(NaN) will output "true"

Strings

A string can contain zero or more characters written inside quotes. For e.g. var car='Tesla', var car="Tesla" , both are same.


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
How to make a curtain slider using jQuery and CSS?CSS4 ways to create Date Objects in JavaScriptJavaScriptModules and its Core features in JavaScriptJavaScriptWhat’s a Strict mode in JavaScript?JavaScriptThe Difference Between Arrays and Objects in JavaScriptJavaScriptWordPress: How to add a Search Icon in Menus with toggle effect using jQuery?jQueryHow to add multiple Columns in CSS like Bootstrap?CSSList of social media icon logo color codes in HEXMiscellaneousHow to change style of nth-child using jQuery?jQueryHow to create a multisite network in WordPress?WordPressHow to Install PHP composer in Mac OS Catalina?PHPVariables and Distance Functions in SCSS (Sass)SCSS