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
const express = require("express"); | |
const app = express(); | |
const route = require("./Routes/index"); | |
const port = 3000; | |
app.use("/", route); | |
app.listen(port, () => { | |
console.log(`App runing at ${port}`); | |
}); |
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 array = [1,2,3] | |
console.log(array) |
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
const product = { | |
data: [ | |
{ | |
name: "Indomie", | |
price: 10000, | |
stock: 15, | |
}, | |
{ | |
name: "Telor Gulung", | |
price: 5000, |
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
const readline = require("readline"); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); | |
const question = (query) => | |
new Promise((resolve) => rl.question(query, resolve)); | |
const tambah = (a, b) => { |
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
// dectruct obj | |
const { | |
rl, | |
question, | |
tambah, | |
perkalian, | |
pengurangan, | |
pembagian, | |
} = require("./count"); |
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
const axios = require('axios'); | |
const url = #URL_REST_API | |
axios.get(url) | |
.then(function (response) { | |
// handle success | |
console.log(response); | |
}) | |
.catch(function (error) { | |
// handle error |
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
goToRevisionPage() { | |
let url = this.router.serializeUrl(this.router.createUrlTree(['/extension-form'], { queryParams: { id: this.doctypeId, did: this.docid, revision: 1 } }) | |
); | |
window.open(url, '_blank') | |
} |
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
let num1:number = 1 | |
let num2:number = 2 | |
const a = num1 < num2 ? 'red' : ( num1 > num2 ? 'blue' : 'green') | |
/** | |
* karena expresi pertama terpenuhi yaitu num1(1) < num2(2) akan bernilai true dan | |
* program tidak akan mengeksekusi expresi selanjutnya karena expresi pertama terpenuhi | |
* dan akan mencetak red di console. sedangkan jika expresi pertama tidak terpenuhi maka | |
* program akan mengeksekusi expresi selanjutnya. | |
* */ |
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
let num1:number = 1 | |
let num2:number = 2 | |
const a = num1 < num2 ? 'red' : 'blue' | |
/** | |
* karena expresi pertama terpenuhi yaitu num1(1) < num2(2) akan bernilai true | |
* maka program akan mengeksekusi expresi kedua yaitu menampilkan red | |
* */ | |
console.log(a) |
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
expresi_satu ? expresi_dua : expresi_tiga |