본문 바로가기

전체 글451

13.Sum of Numbers Description: Given two integers a and b, which can be positive or negative, find the sum of all the integers between and including them and return it. If the two numbers are equal return a or b. Note: a and b are not ordered! Examples (a, b) --> output (explanation) (1, 0) --> 1 (1 + 0 = 1) (1, 2) --> 3 (1 + 2 = 3) (0, 1) --> 1 (0 + 1 = 1) (1, 1) --> 1 (1 since both are same) (-1, 0) --> -1 (-1 .. 2022. 3. 22.
12.Credit Card Mask Description: Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct. However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we mask it. Your task is to write a function maskify, which changes all but the last four characters into '#'. Examples maskify("455.. 2022. 3. 21.
var, let, const 차이 요즘 자바스크립트 강의를 듣고 있는데 예시 코드를 작성할때마다 어떤때에는 var를 쓰고 어떤때에는 let 혹은 const를 사용하길래 그 차이점이 무엇인지 궁금해서 찾아보았다. 작년에 코드숨에서 리액트 강의를 들을때 제일 처음으로 했던 것이 let을 제거해보는 과제였는데,,, 코드숨 강의도 다시 한번 찾아봐야겠다. 변수 선언으로 var가 제일 오래전부터 있었고 let, const는 ES6에서 추가 되었다. var - 변수를 선언하고(선언 단계와 초기화 단계가 동시에 진행된다), 선택적으로 초기화할 수 있다. - 문제점 선언된 변수들은 변수가 선언된 실행 콘텍스트(execution context) 안에서 만들어집니다. 선언되지 않은 변수들은 항상 전역변수 입니다. 함수 외부에서 선언한 변수도 모두 전역 변.. 2022. 3. 20.
11.Complementary DNA Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms. If you want to know more: http://en.wikipedia.org/wiki/DNA In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You function receives one side of the DNA (string, except for Haskell); you need to return the o.. 2022. 3. 20.
10.Jaden Casing Strings Jaden Smith, the son of Will Smith, is the star of films such as The Karate Kid (2010) and After Earth (2013). Jaden is also known for some of his philosophy that he delivers via Twitter. When writing on Twitter, he is known for almost always capitalizing every word. For simplicity, you'll have to capitalize each word, check out how contractions are expected to be in the example below. Your task.. 2022. 3. 20.
9.Shortest Word Description: Simple, given a string of words, return the length of the shortest word(s). String will never be empty and you do not need to account for different data types. function findShort(s){ const words = s.split(' '); const short = words.reduce((previousValue, currentValue) => { return currentValue.length < previousValue.length ? currentValue : previousValue; }); return short.length; } 주어진.. 2022. 3. 18.