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 Bank() { | |
// public variables | |
this.name = 'B7' | |
// public methods | |
this.getBalance = function() { | |
return _balance | |
} | |
this.addToBalance = function(count) { | |
_addBalance(count) |
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
// private variables | |
let _balance = 0 | |
let _logs = [] | |
export default class Bank { | |
constructor() { | |
// public variables | |
this.name = 'B7' | |
} | |
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 _state = new WeakMap() | |
const _addBalance = new WeakMap() | |
const _logBankChange = new WeakMap() | |
export default class Bank { | |
constructor() { | |
// public variables | |
this.name = 'B7' |
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 _addBalance = Symbol('addBalance') | |
const _logBankChange = Symbol('logBankChange') | |
const _privateData = Symbol('privateData') | |
export default class Bank { | |
constructor() { | |
// public variables | |
this.name = 'B7' | |
// private variables |
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 b = new Bank() | |
Object.getOwnPropertySymbols(b) | |
Object.getOwnPropertySymbols(b.__proto__) |
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
class C { | |
// private method | |
#foo() { console.log('hi'); } | |
bar() { | |
#foo(); | |
} | |
} |
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
// 1 | |
const player = new GameSDK.Player(options); | |
// 2 | |
const roomId = await player.createRoom(options); | |
// 3 | |
player.joinRoom(roomId); |
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
#redBox { | |
width: 25px; | |
height: 25px; | |
background-color: red; | |
} |
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
import { StyleSheet } from 'react-native'; | |
StyleSheet.create({ | |
redBox: { | |
width: 25, | |
height: 25, | |
backgroundColor: 'red', | |
} | |
}); |
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
try { | |
const news = await getAllNews(input); | |
} catch (err) { | |
console.log(err.message); // automatic generated message for getAllNews function | |
} |