Page 333 - Webapplication11_C11_Flipbook
P. 333

When you click on the Add Div button, a new div elements is added to the web page.
















                   4.14 JAVASCRIPT DATA TYPES
                 In JavaScript, data types are categorized into two main types: primitive and non-primitive (or reference) data types.
                 Here’s a breakdown of each category:

                 Primitive Data Types

                 Primitive data types are the basic building blocks of data in JavaScript. They are immutable (cannot be changed) and
                 are stored directly in the variable. The primitive data types in JavaScript are:
                 Ð ÐString: Represents a sequence of characters enclosed in single quotes, double quotes, or backticks.
                   Example:

                   let name = "John";
                 Ð ÐNumber: Represents both integer and floating-point numbers.
                   Example:
                   let age = 25;

                   let price = 19.99;
                 Ð ÐBoolean: Represents a logical entity and can have two values: true or false.
                   Example:
                   let isStudent = true;

                 Ð ÐUndefined: A variable that has been declared but has not been assigned a value is of type undefined.
                   Example:

                   let myVariable;
                   console.log(myVariable); // Output: undefined

                 Ð ÐNull: Represents the intentional absence of any object value. It is often used to indicate that a variable should have
                   no value.
                   Example:

                   let emptyValue = null;
                 Ð ÐSymbol (introduced in ECMAScript 6): Represents a unique and immutable value, often used as object property
                   keys.

                   Example:
                   const uniqueID = Symbol('id');

                 Ð ÐBigInt (introduced in ECMAScript 2020): Represents integers with arbitrary precision, useful for very large numbers.
                   Example:

                    let bigNumber = 1234567890123456789012345678901234567890n; // Note the 'n' at
                   the end
                                                                                                  JavaScript Part 1  331
   328   329   330   331   332   333   334   335   336   337   338