일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- 스프링
- includes()
- javascript
- sql
- 배열에 문자열
- ArrayMethods
- 문자열 포함
- There is no tracking information for the current branch
- maven
- CodeTutorial
- StateManagement
- FrontEndDevelopment
- java
- WebDevelopment
- 배열
- JS
- JavaScriptTutorial
- LearnCoding
- DeveloperTips
- ReactHooks
- eclipse
- SoftwareEngineering
- CodingTutorial
- Spring
- git lab
- error
- Oracle
- 배열에 특정 요소 포함
- preventDefailt
- ProgrammingTips
- Today
- Total
목록javascript (6)
Code Party Lounge
1. push(): 배열 끝에 요소 추가 let fruits = ['apple', 'orange']; fruits.push('banana'); // fruits는 이제 ['apple', 'orange', 'banana'] 2. pop(): 배열 끝에서 요소 제거하고 반환 let fruits = ['apple', 'orange', 'banana']; let removedFruit = fruits.pop(); // removedFruit은 'banana', fruits는 ['apple', 'orange'] 3. shift(): 배열 앞에서 요소 제거하고 반환 let fruits = ['apple', 'orange', 'banana']; let removedFruit = fruits.shift(); // re..
React에서 state 값을 변경하는 방법은 두 가지가 있습니다. 함수형 컴포넌트에서는 useState 훅을 사용하고, 클래스형 컴포넌트에서는 setState 메서드를 사용합니다. 주어진 두 가지 변수(person과 personList)의 특정 값을 변경하는 방법을 설명하겠습니다. 1. person의 특정 값 변경 - useState 훅을 사용하여 person을 상태로 관리합니다. - useState를 사용하여 상태를 설정하고, 필요한 값을 변경한 후 새로운 상태로 설정합니다. import React, { useState } from 'react'; // Person 타입 정의 type Person = { id: number; first_name: string; last_name: string; add..
1. e.preventDefailt() - 브라우저 고유의 동작을 중단시켜주는 역할. preventDefault() 메서드는 이벤트가 전파되는 것(*버블링이나 *캡쳐 단계)를 중지시키지는 않는다. 주로 사용되는 경우는 1. a 태그를 눌렀을 때 href 링크로 이동하지 않게 할 경우 2. form 태그 안에 submit 역할을 하는 버튼을 눌렀을 때 새로고침 하고싶지 않은 경우 * 이벤트 버블링이란? 자식 element에서 발생된 event가 부모 element순으로 전달되는 현상 * 이벤트 캡쳐링이란? 부모 element에서 발생된 event가 자삭 element순으로 전달되는 현상 2. e.stopPropagation() - 부모 엘리먼트에게 이벤트 전달을 중단시켜주는 역할. stopPropagati..
includes() - includes() 메서드는 배열이 특정 요소를 포함하고 있는지 판별합니다. arr.includes(valueToFind[, fromIndex]) valueToFind 탐색할 요소. 참고: 문자나 문자열을 비교할 때, includes()는 대소문자를 구분합니다. fromIndex (Optional) 이 배열에서 searchElement 검색을 시작할 위치입니다. 음의 값은 array.length + fromIndex의 인덱스를 asc로 검색합니다. 기본값은 0입니다. 예제 [1, 2, 3].includes(2); // true [1, 2, 3].includes(4); // false [1, 2, 3].includes(3, 3); // false [1, 2, 3].includes(3..
reverse() - reverse() 메서드는 배열의 순서를 반전합니다. 첫 번째 요소는 마지막 요소가 되며 마지막 요소는 첫 번째 요소가 됩니다. 예시 const array1 = ['one', 'two', 'three']; console.log('array1:', array1); // expected output: "array1:" Array ["one", "two", "three"] const reversed = array1.reverse(); console.log('reversed:', reversed); // expected output: "reversed:" Array ["three", "two", "one"] // Careful: reverse is destructive -- it chang..
substring() - substring() 메소드는 string 객체의 시작 인덱스로부터 종료 인덱스 전까지 문자열의 부분 문자열을 반환합니다. str.substring(indexStart[, indexEnd]) substring() 메서드는 indexStart 부터 문자를 추출하지만 indexEnd 가 포함되지 않아도 괜찮습니다. 특징은 아래와 같습니다. 만약 indexEnd 가 생략된 경우, substring() 문자열의 끝까지 모든 문자를 추출합니다. 만약 indexStart 가 indexEnd와 같을 경우, substring() 빈 문자열을 반환합니다. 만약 indexStart 가 indexEnd보다 큰 경우, substring() 메서드는 마치 두 개의 인자를 바꾼 듯 작동하게 됩니다. 아래..