JS/[codeit] 프로그래밍기초 in JS (완) 8

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍과 데이터 in JS (4)

과제로 복습하기 1강. 팩토리얼! 0! = 1 1! = 1 2! = 1 * 2 = 2 3! = 1 * 2 * 3 = 6 .. 을 구하는 함수 만들기 function factorial(n) { let result = 1; // 여기에 코드를 작성해 주세요. for(let i =1; i= 1; i--) { result = result * i; } return result; } // 테스트 코드 console.log(factorial(12)); console.log(factorial(6)); console.log(factorial(3)); console.log(factorial(0)); 2강. 거스름돈 구하기 function calculateChange(payment, cost) { // 코드를 작성해 주세요..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍과 데이터 in JS (3)

자료형 심화 1강. 다양한 숫자 표기법 //숫자 표기법 let millionaire = 100000000; let myNumber = 1e9; //지수표기법 1 * e의 9승 console.log(millionaire); //100000000 console.log(myNumber); //100000000 console.log(millionaire === myNumber); //true console.log(25e5 === 2500000); //true console.log(5.3e3 === 5300); //true console.log(-6.1e8 === -610000000); //true console.log(16e-5 === 0.0016); //true console.log(3.5e-3 === 0.0..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍과 데이터 in JS (2)

배열 1강. 배열 순서(위)가있는 값을 활용할 때 객체보다 유용 //배열(Array) let courseRanking = { '1st' : 'js기초', '2nd' : 'git', '3rd' : '컴퓨터개론', '4th' : '파이썬' } //▽ let courseRanking = [ 'js기초', //요소(element) 'git', '컴퓨터개론', '파이썬' ] //배열내 순서 index == propertyName(객체) //indexing : 원하는 배열의 요소를 가져올 때, 0~ //console.log(배열이름[index]); console.log(courseRanking[0]); //js기초 console.log(courseRanking[2]); //컴퓨터개론 console.log(cours..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍과 데이터 in JS (1)

객체 1강. 객체와 프로퍼티 객체(Object) : 연관된 여러 값을 한번에 저장 '자바스크립트의 모든 것이 객체다!' { brandName : '코드잇', bornYear : 2017, isVeryNice : true, worstCourse : null, bestCourse: { title :'자바스크립트', language : 'javascript' } //(property)key : (property)value = property(객체의 속성) // └ string 문자열이지만 └ 문자열, 숫자, 불린, null 가능, 객체내 객체 가능 // 따옴표 생략가능, 생략시 1,2,3 // 1. 첫글자는 반드시 문자, 밑줄(_), 달러기호($) 중 하나로 시작 // 2. 띄어쓰기 x // 3. 하이픈 - ..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍 핵심개념 in JS (3)

제어문 1강. if문 (if statement) //if문 (if statement) if(조건부분){ 동작부분 } let temperature = 0; if(temperature = LIMIT) { console.log(passMessage); } else { console.log(failMessage); } } 유지보수를 위해 140을 변수화해주기 3강. else if문 //if문 (if statement) let temperature = -105; if(temperature = B_SCORE){ console.log('B'); } else if ( totalScore >= C_SCORE){ console.log('C'); } else if ( totalScore >= D_SCORE){ console..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍 핵심개념 in JS (2)

추상화 1강. 할당 연산자 //할당 연산자 (Assignment operators) let name = '코드잇'; let x = 5; x = x - 2; console.log(x); //3 2. 복합 할당 연산자 복합 할당 연산자(Compound assignment operators) : 할당 연산자와 결합하여 더 간략하게 사용가능 //같은 식 x = x + 1; x += 1; 증가(increment), 감소(decrement) 연산자 : 1씩 증가, 감소시킬 때 더 간략히 사용가능 //모두 같은 식 x = x + 1; x += 1; x++; 3. 함수의 실행 순서 //함수정의 function sayHello(){ console.log('Hello'); console.log('Welcome to Cod..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍 핵심개념 in JS (1)

자료형 1강. 숫자형 //덧셈 console.log(1 + 8); //9 //뺄셈 console.log(6 - 7); //-1 //곱셈 console.log(2 * 2); //4 //나눗셈 console.log(5 / 2); //2.5 //나머지 console.log(7 % 3); //1 //참고: 몫 구하기 const a = Math.trunc(4/3) console.log(typeof a, a) //거듭제곱 console.log(2 ** 3); //8 (= 2의 3승); //사칙연산 순서 console.log(2 + 3 * 2); //8 console.log((2+3) * 2); //10 2강. 숫자 연산 익히기 우선순위 () > ** > *, / > +, - 3강. 문자열 기본 console.log..

[ codeit ] 프로그래밍 기초 in JS - 프로그래밍 시작하기 in JS

자바스크립트 첫 걸음 1강. 자바스크립트 프로그래밍? 웹사이트를 만들고싶다면 반드시 배워야하는 프로그래밍 언어, web을 넘어 다양한 분야에 활용 1989년 웹의 첫 등장, 90년대 보편화 JS의 다양한 활용 언어의 문법 x 프로그래밍의 원리 o 2강. 준비하기 VSCode 3강. Hello Codeit! Ctrl S 저장하기 Ctrl O 불러오기 4강. 프로그래밍 첫걸음 떼기 console.log(15) 프로그래밍 맛보기 1강. 세미콜론 문장이 끝났다는 의미, 예상치못한 오류방지 2강. 코멘트 // 주석 comment /* 여러줄 주석입니다. */ 어떤 의도로 코드가 작성되었는지 설명할 때, 구현한 코드가 어떤 동작을 하는지 기록할 때 3강. 자료형 개요 프로그래밍이란? 컴퓨터로 복잡한 계산을 하는 것..

반응형