Variable Scope

Run Settings
LanguageJavaScript
Language Version
Run Command
// // global variable, dapat diakses pada parent() dan child() // const a = 'a'; // function parent() { // // local variable, dapat diakses pada parent() dan child(), tetapi tidak dapat diakses diluar dari fungsi tersebut. // const b = 'b'; // function child() { // // local varible, dapat diakses hanya pada fungsi child(). // const c = 'c'; // } // } function multiply(num) { total = num * num; return total; } let total = 9; let number = multiply(20); console.log(total); let numbers = [12, 1, 23, 2] // console.log(numbers[numbers.length]); numbers[numbers.length - 1];
Editor Settings
Theme
Key bindings
Full width
Lines