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
/************************************************** | |
* Immediatly executing anonymous function | |
**************************************************/ | |
// Results in error "TypeError: console.log(...) is not a function" | |
console.log('example') | |
(async () => {})() | |
// With using of ; it works |
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
// with a sql tagged template literal use parameters directly in the sql query | |
const id = 5 | |
const name = 'new name' | |
client.query(sql` | |
UPDATE users SET name = ${name} WHERE id = ${id} | |
`) | |
// text: 'UPDATE users SET name = $1 WHERE id = $2' |
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
// example usage | |
const blockchain = new Blockchain(); | |
blockchain.add(1); | |
blockchain.add(2); | |
blockchain.add(3); | |
blockchain.verify(); | |
console.log(blockchain); | |
// example output |