Page 187 - Web_Application_v2.0_C12_Fb
P. 187

  Boolean: The Boolean data type represents only two possible values; true and false. It is primarily used
                    to evaluate logical conditions in a program. Boolean values help in making decisions within a program
                    by checking whether a condition is met or not. These values can be thought of as, true means "yes" and
                    false means "no". When the typeof operator is used to check the type of true or false, it returns "boolean",
                    indicating that the value belongs to the Boolean data type.
                    typeof(true) // This will return Boolean

                   typeof(false) // This will return Boolean
                    For example:
                    var a =8;

                   var b=5;
                   a==b // This will return false
                   Undefined: A variable that has been declared but has not been assigned a value is of type undefined.
                    For example:

                   var city;
                   console.log(city);
                   Null: Represents the intentional absence of any object value. It is often used to indicate that a variable
                    should have no value.
                    For example:


                   var favouriteDish = null;
                   console.log(favouriteDish);
                   Symbol (introduced in ECMAScript 6): Represents a unique and immutable value, often used as object
                    property keys.

                    For example:
                   const id = Symbol('Asha');
                   BigInt (introduced in ECMAScript 2020): Represents integers with arbitrary precision, useful for very
                    large numbers.
                    For example:
                    Var bigNumber = 9876543210123456789012345678901234567890n; // Note the 'n' at

                    the end
                             Notes

                             In JavaScript, NaN stands for "Not-a-Number" and represents a value that is not a valid or
                             legal number.


                 Non-Primitive Data Types

                 There are more complex data types called non-primitive or reference types. These can hold multiple values or
                 complex information. They can be changed and include:
                   Object: A collection of key-value pairs, where keys are strings (or symbols) and values can be of any data
                    type.

                    For example:
                   var person = {

                                                                                                  JavaScript Part 2  185
   182   183   184   185   186   187   188   189   190   191   192