repl.it
@drubio/

ES5: Everything is an object

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Empty object literal
var stuff = {}; 

// Add property and value
stuff.language = 'JavaScript';

// Create populated object literal
var languages = {'JavaScript':
                    {
                      'versions':[
                            {'ES5': 'ECMAScript 5'},
                            {'ES6': 'ECMAScript 6'},
                            {'ES7': 'ECMAScript 7'},
                            {'TS' : 'TypeScript'}
                      ]
                    }
                }

// Create populated object literal with function 
var wonderful = {
       flag: true,
       constant: "Object literal",
       render: function() { 
           console.log("Hello from wonderful.render()!");
          }
}

console.log(stuff);
console.log(Object.prototype.toString.call(stuff));  // [object Object]
console.log(languages);
console.log(Object.prototype.toString.call(languages)); // [object Object]
console.log(wonderful);
console.log(Object.prototype.toString.call(wonderful)); // [object Object]
Native Browser JavaScript