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
| if (confirm('Are you sure?')) { | |
| console.log('Confirmed'); | |
| } else { | |
| console.log('Canceled'); | |
| } |
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
| setTimeout(function () { | |
| console.log('แสดงอันที่สอง (หลังจากอันแรก 1 วินาที)'); | |
| }, 1000); | |
| console.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
| // import stuffs | |
| app.delete('/todos/:id', (req, res) => { // deletes a todo and return current todo list | |
| const ctx = new TodoContext(req); | |
| Promise.resolve() | |
| .then(() => authorize(['user', 'admin'])) | |
| .then(({ user, roles }) => { | |
| let promise; | |
| if (roles.indexOf('admin') >= 0 && req.query.permanent) | |
| promise = Todo.remove({ _id: req.params.id}); |
NewerOlder