When 사용법 fun main() { helloWorld(); println(add(4, 5)) val name = "kyhslam" println("my name is ${name} ddf") println(maxBy2(4, 7)) } fun add(a: Int, b: Int): Int { return a + b } fun maxBy2(a: Int, b: Int) = if (a > b) a else b //when 사용법 fun checkNum(score: Int) { when (score) { 0 -> println("this is 0") 1 -> println("") 2, 3 -> print("this is 2 or 3") } var b = when (score) { 1 -> 1 2 -> 2 el..
배열 1. 선언(Declaration) const arr1 = new Array(); const arr2 = [1,2]; 2. Index Position const fruits = ['AA', 'BB']; console.log(fruits); // ["AA", "BB"] console.log(fruits[0]); // AA 3. 순회 및 검색 (Looping over an array) // for for(let i = 0; i < fruits.length; i++) { console.log(fruits[i]); } // of for(let fruit of fruits){ console.log(fruit); } // forEach fruits.forEach(function(fruit, index, arra..