Last active
July 26, 2018 03:33
-
-
Save MirzaChilman/5bd236271bffb699586a487fdba75455 to your computer and use it in GitHub Desktop.
Javascript Bootcamp
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 num =3; | |
const mb = function multiplyBy2 (inputNumber){ | |
const result = inputNumber *2}; | |
return result | |
} | |
const name = "Will" | |
======================================================= | |
function kopiDanKali( array ){ | |
let output = []; | |
for(let i = 0 ; i< array.length; i++){ | |
output.push(array[i] *2) | |
} | |
return output; | |
} | |
const myArray = [1,2,3] | |
kopiDanKali(myArray) | |
function kopiDanBagi( array ){ | |
let output = []; | |
for(let i = 0 ; i< array.length; i++){ | |
output.push(array[i] / 2) | |
} | |
return output; | |
} | |
const myArray = [1,2,3] | |
kopiDanBagi(myArray) | |
function kopiDanTambah( array ){ | |
let output = []; | |
for(let i = 0 ; i< array.length; i++){ | |
output.push(array[i] + 3) | |
} | |
return output; | |
} | |
const myArray = [1,2,3] | |
kopiDanTambah(myArray) | |
============================ | |
function kopiDanUbah( array, instruksi ){ | |
let output = []; | |
for(let i = 0 ; i< array.length; i++){ | |
output.push(instruksi(array[i])) | |
} | |
return output; | |
} | |
function kali2 (inputNumber){ | |
return inputNumber * 2 | |
} | |
const myArray = [1,2,3] | |
kopiDanUbah(myArray, kali2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment