본문 바로가기

분류 전체보기

(81)
ddays 계산하기 https://velog.io/@katej927/JavaScript-D-day-%EA%B3%84%EC%82%B0 JavaScript | D-day 계산 Date 생성자시간의 특정 지점을 나타내는 Date 객체 생성Date 객체 1970년 1월 1일 UTC(국제 표준 시) 00:00으로부터 지난 시간을 밀리 초로 나타내는 유닉스 타임 스탬프를 사용Date 객체 초기화자바 스 velog.io
Coding Challenge - sum by looping const calcTip = function (bill) { return bill >= 50 && bill
섹션 2 Javascript Fundamentals part 2 - The While Loop /////////////////////////////////////// // The while Loop for (let rep = 1; rep
섹션 2 Javascript Fundamentals part 2 - Looping Backwards and Loops in Loops /////////////////////////////////////// // Looping Backwards and Loops in Loops const jonas = [ 'Jonas', 'Schmedtmann', 2037 - 1991, 'teacher', ['Michael', 'Peter', 'Steven'], true ]; // 0, 1, ..., 4 // 4, 3, ..., 0 for (let i = jonas.length - 1; i >= 0; i--) { console.log(i, jonas[i]); } for (let exercise = 1; exercise < 4; exercise++) { console.log(`-------- Starting exercise ${exercise}`); fo..
섹션 2 Javascript Fundamentals part 2 - Looping Arrays, Breaking and Continuing /////////////////////////////////////// // Looping Arrays, Breaking and Continuing const jonas = [ 'Jonas', 'Schmedtmann', 2037 - 1991, 'teacher', ['Michael', 'Peter', 'Steven'], true ]; const types = []; // console.log(jonas[0]) // console.log(jonas[1]) // ... // console.log(jonas[4]) // jonas[5] does NOT exist for (let i = 0; i < jonas.length; i++) { // Reading from jonas array console.log(jon..
섹션 2 Javascript Fundamentals part 2 - Iteration: The for Loop /////////////////////////////////////// // Iteration: The for Loop // console.log('Lifting weights repetition 1 🏋️‍♀️'); // console.log('Lifting weights repetition 2 🏋️‍♀️'); // console.log('Lifting weights repetition 3 🏋️‍♀️'); // console.log('Lifting weights repetition 4 🏋️‍♀️'); // console.log('Lifting weights repetition 5 🏋️‍♀️'); // console.log('Lifting weights repetition 6 🏋️‍♀️'); // cons..
섹션 2 Javascript Fundamentals part 2 - Object Methods /////////////////////////////////////// // Object Methods const jonas = { firstName: 'Jonas', lastName: 'Schmedtmann', birthYeah: 1991, job: 'teacher', friends: ['Michael', 'Peter', 'Steven'], hasDriversLicense: true, // calcAge: function (birthYeah) { // return 2037 - birthYeah; // } // calcAge: function () { // // console.log(this); // return 2037 - this.birthYeah; // } calcAge: function () { ..
섹션 2 Javascript Fundamentals part 2 - Dot vs Bracket Notation /////////////////////////////////////// // Dot vs. Bracket Notation const jonas = { firstName: 'Jonas', lastName: 'Schmedtmann', age: 2037 - 1991, job: 'teacher', friends: ['Michael', 'Peter', 'Steven'] }; console.log(jonas); console.log(jonas.lastName); console.log(jonas['lastName']); const nameKey = 'Name'; console.log(jonas['first' + nameKey]); console.log(jonas['last' + nameKey]); // console..
섹션 2 Javascript Fundamentals part 2 - Introduction to Objects /////////////////////////////////////// // Introduction to Objects const jonasArray = [ 'Jonas', 'Schmedtmann', 2037 - 1991, 'teacher', ['Michael', 'Peter', 'Steven'] ]; const jonas = { firstName: 'Jonas', lastName: 'Schmedtmann', age: 2037 - 1991, job: 'teacher', friends: ['Michael', 'Peter', 'Steven'] };
섹션 2 Javascript Fundamentals part 2 - Basic Array Operations /////////////////////////////////////// // Basic Array Operations (Methods) const friends = ['Michael', 'Steven', 'Peter']; // Add elements const newLength = friends.push('Jay'); console.log(friends); console.log(newLength); friends.unshift('John'); console.log(friends); // Remove elements friends.pop(); // Last const popped = friends.pop(); console.log(popped); console.log(friends); friends.shi..