본문 바로가기

Research/Javascript15

Regex_replacing special chrs and space Situation Want to create regex to replace all space and special characters except number and alphabets Solution function replaceSpecialCharacters(text) { // Create a regular expression that matches all space and special characters. const pattern = new RegExp(/[\W_]/g); // Replace all matches with an empty string. return text.replace(pattern, ""); } // Example const text = "This is a test string... 2023. 9. 22.
Javascript-웹사이트에 지도 추가하기(Tutorial) 웹사이트에 지도 추가하기(자바스크립트) https://developers.google.com/codelabs/maps-platform/maps-platform-101-js?hl=ko#0 1.시작하기 전에 자바스크립트로 구글 맵스에 몇 개의 핀을 찍어서 렌더링 해주는 작업을 해보자. 수행하는 내용 Maps JavaScript API 동적으로 로드 첫 지도 로드 마커 및 마커 클러스터링 사용 Maps JavaScript API 이벤트 시스템 사용하여 사용자 상호작용 제공 동적으로 지도 조정 지도에 그리기 2. 사전 준비사항 이게 필요하다 Maps JavaScript API MarkerClustererPlus 오픈소스 마커 클러스터링 라이브러리 3. 설정하기 API키 만들기 마켓 플레이스에서 Google Ma.. 2023. 5. 2.
Javascript_비동기 프로그래밍 비동기(Asynchronous) 프로그래밍 비동기 프로그래밍(Asynchronous Programming)은 오래 걸리는 작업을 처리하는 동시에 해당 작업이 끝나기 전에 다른 작업들도 수행하는 기술이다. 주로 HTTP 요청(fetch()), getUserMedia()로 유저의 I/O 정보 접근, showOpenFilePicker()로 유젖가 파일을 올리는 작업 등 잠재적으로 시간이 소요될 것 같은 작업들에 비동기가 주로 적용된다. 동기(synchronous) 프로그래밍 const brand = 'Margiela'; const comment = `Thank you for visiting ${brand}'s fashion show`; console.log(comment); 위 코드에서 .. 2023. 4. 13.
Javascript_for, for in, for of는 무엇이 다른가(번역) 들어가기 자바스크립트에서는 for문 뿐만 아니라 for..in, for..of 등 다양한 유형의 반복문들이 있다. 이들은 서로 어떤 점에서 다른지 알아보자. 목차 자바스크립트의 반복문의 유형과 특징 객체인 배열에 키/값 쌍을 추가하면 키는 어디에 있나? Non-numeric property가 포함된 배열에 반복문을 돌리면? 빈 공간(,,)이 포함된 배열에 반복문을 돌리면? 그 외 정리 6. 정리 numeric vs. non-numeric property 관점에서 반복문 비교 for : numeric property만 출력 for of : numeric property만 출력 forEach : numeric property만 출력 for in : numeric + non-numeric property 모두.. 2023. 2. 6.