Created
December 20, 2020 12:16
-
-
Save otar/06c19e9948d4311bfb0d452c078a4645 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/buliwuk
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var obj = { | |
a: 'some string', | |
b: 123, | |
c: [ | |
'some string', | |
123, | |
[ | |
'some string', | |
123 | |
] | |
], | |
d: { | |
a: 123, | |
b: 'some other string' | |
} | |
}; | |
console.log(obj.a); | |
console.log(obj.c[2][1]); | |
console.log(obj.d.b); | |
////////////////////////////// | |
var a = "some string"; | |
var b = 123; | |
var obj2 = { | |
a, | |
b | |
}; | |
console.log(obj2.a); | |
console.log(obj2.b); | |
////////////////////////////// | |
var doSomething4 = function() { | |
return 'Calling doSomething4()'; | |
}; | |
var obj3 = { | |
doSomething: function() { | |
return 'Calling doSomething()'; | |
}, | |
doSomething2: () => { | |
return 'Calling doSomething2()'; | |
}, | |
doSomething3: () => 'Calling doSomething3()', | |
doSomething4, | |
doSomething5() { | |
return 'Calling doSomething5()'; | |
} | |
}; | |
console.log(obj3.doSomething()); | |
console.log(obj3.doSomething2()); | |
console.log(obj3.doSomething3()); | |
console.log(obj3.doSomething4()); | |
console.log(obj3.doSomething5()); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
var obj = { | |
a: 'some string', | |
b: 123, | |
c: [ | |
'some string', | |
123, | |
[ | |
'some string', | |
123 | |
] | |
], | |
d: { | |
a: 123, | |
b: 'some other string' | |
} | |
}; | |
console.log(obj.a); | |
console.log(obj.c[2][1]); | |
console.log(obj.d.b); | |
////////////////////////////// | |
var a = "some string"; | |
var b = 123; | |
var obj2 = { | |
a, | |
b | |
}; | |
console.log(obj2.a); | |
console.log(obj2.b); | |
////////////////////////////// | |
var doSomething4 = function() { | |
return 'Calling doSomething4()'; | |
}; | |
var obj3 = { | |
doSomething: function() { | |
return 'Calling doSomething()'; | |
}, | |
doSomething2: () => { | |
return 'Calling doSomething2()'; | |
}, | |
doSomething3: () => 'Calling doSomething3()', | |
doSomething4, | |
doSomething5() { | |
return 'Calling doSomething5()'; | |
} | |
}; | |
console.log(obj3.doSomething()); | |
console.log(obj3.doSomething2()); | |
console.log(obj3.doSomething3()); | |
console.log(obj3.doSomething4()); | |
console.log(obj3.doSomething5()); | |
</script></body> | |
</html> |
This file contains 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 obj = { | |
a: 'some string', | |
b: 123, | |
c: [ | |
'some string', | |
123, | |
[ | |
'some string', | |
123 | |
] | |
], | |
d: { | |
a: 123, | |
b: 'some other string' | |
} | |
}; | |
console.log(obj.a); | |
console.log(obj.c[2][1]); | |
console.log(obj.d.b); | |
////////////////////////////// | |
var a = "some string"; | |
var b = 123; | |
var obj2 = { | |
a, | |
b | |
}; | |
console.log(obj2.a); | |
console.log(obj2.b); | |
////////////////////////////// | |
var doSomething4 = function() { | |
return 'Calling doSomething4()'; | |
}; | |
var obj3 = { | |
doSomething: function() { | |
return 'Calling doSomething()'; | |
}, | |
doSomething2: () => { | |
return 'Calling doSomething2()'; | |
}, | |
doSomething3: () => 'Calling doSomething3()', | |
doSomething4, | |
doSomething5() { | |
return 'Calling doSomething5()'; | |
} | |
}; | |
console.log(obj3.doSomething()); | |
console.log(obj3.doSomething2()); | |
console.log(obj3.doSomething3()); | |
console.log(obj3.doSomething4()); | |
console.log(obj3.doSomething5()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment