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
function factoryFunction(name){ | |
// closure | |
let _name = name; | |
return { | |
name: _name, | |
info(){ | |
return 'Some info'; | |
} |
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
// Create object | |
const user = new Object(); | |
// Add properties and methods | |
user.name = 'Alex'; | |
user.info = function() { | |
return 'Some info'; | |
} |
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
const user = new Object(); | |
user.name = 'Alex'; | |
user.info = function() { | |
return 'Some info'; | |
} |
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
const user = { | |
name: 'Alex', | |
info(){ | |
return 'Some info'; | |
} | |
} |