JavaScript for Beginners - Basic Concepts (Data Types) (P: VI)
Data Types The term data type refers to the types of values with which a program can work. JavaScript variables can hold many data types, such as numbers , strings , arrays and many more. Unlike many other programming languages, JavaScript dose not define different types of numbers like integers, short, long, floating-point, etc. Numbers JavaScript numbers can be written with or without decimals . JavaScript numbers can also have decimals Result: Note: JavaScript numbers are always stored as double precision floating point numbers. Strings JavaScript strings are used for storing and manipulating text. A string can be any text that appears within quotes. You can single or double quotes. You can use quotes inside a string as they don’t match the quotes surrounding the string. As strings, must be written within quotes, quotes inside the string must be handled. The backslash (\) escape character turns special characters into string characters. Result: Note: If yo...