⊗jsOpBsIC 26 of 60 menu

Built-in JavaScript classes

JavaScript has many built-in classes that you've encountered before. Let's look at working with dates as an example:

let date = new Date;

If we output the date object to the console, we will see its string representation:

console.log(date);

You can, however, see a list of the object's properties and methods in the console. To do this, use the following command:

console.dir(date);

Examine the output of the following code:

let reg = new RegExp; console.log(reg); console.dir(reg); console.log(reg instanceof RegExp);

Examine the output of the following code:

let arr = [1, 2, 3]; console.log(arr); console.dir(arr); console.log(arr instanceof Array);

Examine the output of the following code:

let arr = new Array(1, 2, 3); console.log(arr); console.dir(arr); console.log(arr instanceof Array);

Examine the output of the following code:

let obj = {a: 1, b: 2, c: 3}; console.log(obj); console.dir(obj); console.log(obj instanceof Object);

Examine the output of the following code:

let obj = new Object; console.log(obj); console.dir(obj); console.log(obj instanceof Object);
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline