HTML

Object:

Object is a collection of properties.
Objects can contain more than one value.
  • Booleans can be objects (if defined with the new keyword)
  • Numbers can be objects (if defined with the new keyword)
  • Strings can be objects (if defined with the new keyword)
  • Dates are always objects
  • Maths are always objects
  • Regular expressions are always objects
  • Arrays are always objects
  • Functions are always objects
  • Objects are always objects
Syntax: var object_name={name:"value",name:"value",name:"value"};

EX:
Code:

OUTPUT:


Properties:
  • Properties are nothing but name/value pairs.
  • we can access object properties in two ways.
 Syntax: objname. properytname
                          or
                 objname["properytname"]
Methods:
Objects can also have methods.
Methods are stored in properties as function definition.

EX:
Code:
OUTPUT:
This:
This is a keyword.
In javascript it is used to refer the object it belongs to.
if we use it in a method then it refers to the owner object.

Date Methods()
OUTPUT:

Math:
It is used to perform mathematical operations on numbers.
1.Math.round():

  • Math.round(x) returns the value of x rounded to its nearest integer:
  •  Ex:Math.round(5.2)
  •  output:5

2.Math.pow():

  • Math.pow(x, y) returns the value of x to the power of y:
  • Ex:math.pow(3,2)
  • output:9

3.Math.Sqrt():

  • Returns the square root of x.
  • Ex:math.sqrt(36)
  • output::6

4.Math.abs():

  • Returns the absolute value of x.
  • Ex:math.abs:(-2.8)
  • output:2.8

5.Math.ceil():

  • Returns the value of x rounded up to its nearest integer.
  • Ex:math.ceil(25.5)
  • output:25

6.Math.floor():

  • Returns the value of x rounded down to its nearest integer.
  • Ex:math.floor(4.2)
  • output:4

7.Math.min():

  • Returns the lowest number of given numbers.
  • Ex:math.min(0,-8,25,71,32,9);
  • output:-8

8.Math.max():

  • Returns the highest number of given numbers.
  • Ex:math.max(10,1,5,8,15)
  • output:15

9.Math.random():

  • Returns the random number between 0 and 1.
  • Ex:math.random();
  • output:0.157532
EX:
Code:


OUTPUT: