본문 바로가기

Happly Coding10

[CodeWars] 8kyu#9 - Basic Training: Add item to an Array [CodeWars] 8kyu#9 - Basic Training: Add item to an Array ■ Description:Add the value "codewars" to the websites array.After your code executes the websites array should == ["codewars"] The websites array has already been defined for you using the following code:var websites = []; ■ Qustion// add the value "codewars" to the already defined websites array ■ My Solution....? ■ Best Solutionwebsites.. 2016. 6. 6.
[CodeWars] 8kyu#8 - Shifty Closures [CodeWars] 8kyu#8 - Shifty Closures ■ Description:Functional closures can get overly attached. Set them straight! Why doesn't greet_abe() actually greet Abe? ■ Qustion12345678var name = 'Abe';var greet_abe = function() { return "Hello, " + name + '!';};name = 'Ben';var greet_ben = function() { return "Hello, " + name + '!';};cs ■ My Solution123456789var greet_abe = function() { var name = 'Abe';.. 2016. 6. 6.
[CodeWars] 8kyu#7 - Short Long Short [CodeWars] 8kyu#7 - Short Long Short ■ Description: Given 2 strings, a and b, return a string of the form short+long+short, with the shorter string on the outside and the longer string on the inside. The strings will not be the same length, but they may be empty (length0). solution("1", "22") // returns "1221"solution("22", "1") // returns "1221"solution("1", "22") // returns "1221"solution("22".. 2016. 5. 30.
[CodeWars] 8kyu#6 - Multiply [CodeWars] 8kyu#6 - Multiply ■ Description:The code does not execute properly. Try to figure out why. ■ Qustion:123function multiply(a, b){ a * b}cs ■ My Solution:123function multiply(a, b){ return a * b;}cs ■ 추가function에서 return을 할 수가 없다!!var aaa = multiply(3,4); console.log(aaa); // 화면에 출력alert(aaa); // 경고창으로 출력 2016. 5. 29.