console.log('5%2:', 5%2);
const numbers = [5,6,7,8];
console.log(numbers[0], 'is even number:', numbers[0] %2 === 0);
console.log(numbers[1], 'is even number:', numbers[1] %2 === 0);
console.log(numbers[2], 'is even number:', numbers[2] %2 === 0);
console.log(numbers[3], 'is even number:', numbers[3] %2 === 0);
- ===는 비교연산자로 비교하는 두 값이 같은지 비교한다.
const string ='hello';
const string2 = ' The method then selects elements from the start argument, and up to (but not including) the end argument.';
console.log('string:', string.length);
console.log('string2:', string2.length);
console.log('string[0]:', string[0]);
console.log('string2[104]:', string2[104]);
const string = 'hello';
const string2 = 'helelelelelello';
const string3 = 'The method then selects elements from the start argument';
console.log('hel:' ,string.indexOf('hel'));
console.log('el:' ,string.indexOf('hel'));
console.log('elelelel:' ,string2.indexOf('elelelel'));
console.log('method:' ,string3.indexOf('method'));
console.log('bye:' ,string3.indexOf('bye'));
const numbers = [1,2,3];
const strings = ['hello','bye','welcome'];
const numbers2 = new Array(1,2,3);
const strings2 = new Array('hello','bye','welcome');
console.log('numbers:', numbers);
console.log('strings:', strings);
console.log('numbers2:', numbers2);
console.log('strings2:', strings2);
const arNumbers = [];
arNumbers.push(1);
arNumbers.push(2);
arNumbers.push(3);
const arTexts = [];
arTexts.push('hello','welcome','bye');
console.log(arNumbers);
console.log(arTexts);
const arCoffee = [];
console.log(arCoffee[0]);
console.log(arCoffee.length);
arCoffee.push('아메리카노','라떼','카푸치노');
console.log(arCoffee.length);
console.log(arCoffee[0]);
'프로그래밍 이야기 > Node.js' 카테고리의 다른 글
Node.js 콘솔로그 - Console.log (0) | 2023.08.27 |
---|---|
Node.js 논블로킹IO / 블로킹IO (0) | 2023.08.23 |
Node.js 사이트 메뉴얼 확인 (0) | 2023.08.13 |