A Pen by Suman Paul on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = [1,2,3]; | |
Object.keys(a); | |
//returns ["0", "1", "2"] | |
Object.getOwnPropertyNames(a) | |
//returns ["0", "1", "2", "length"] | |
a.propertyIsEnumerable(0); // returns true | |
a.propertyIsEnumerable('length'); // returns false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = { | |
firstName: 'Suman', | |
lastName: 'Paul', | |
age: 30 | |
}; | |
Object.defineProperty(user, 'gender', { | |
enumerable: false, | |
value: 'male' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = { | |
firstName: 'Suman', | |
lastName: 'Paul', | |
age: 30 | |
}; | |
Object.keys(user); | |
//returns ["firstName", "lastName", "age"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Object Properties | |
Object.length; //returns 1 | |
Object.prototype; //returns {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"node": true, | |
"browser": true, | |
"esnext": true, | |
"bitwise": true, | |
"camelcase": false, | |
"curly": true, | |
"eqeqeq": true, | |
"immed": true, | |
"indent": 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"indent_size": 2, | |
"indent_char": " ", | |
"indent_level": 0, | |
"indent_with_tabs": false, | |
"preserve_newlines": true, | |
"max_preserve_newlines": 10, | |
"jslint_happy": true, | |
"brace_style": "collapse", | |
"keep_array_indentation": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
fs.createReadStream('test.log').pipe(fs.createWriteStream('newLog.log')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cardJSON1 = { | |
text:'this is text', | |
color:'red', | |
position:{ | |
x:200, | |
y:200 | |
} | |
}; | |
var cardJSON2 = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cardJSON = { | |
text:'this is text', | |
color:'red' | |
}; | |
var Card = function(obj){ | |
var that = this; | |
var props = Object.getOwnPropertyNames(obj); | |
props.forEach(function(prop){ | |
var propDescriptor = Object.getOwnPropertyDescriptor(obj, prop); |