JavaScript
-
정규표현식JavaScript 2022. 1. 25. 21:16
자바스크립트의 정규표현식에 대해 정리하였습니다. 정규 표현식은 문자열에 나타는 특정 문자 조합과 대응시키기 위해 사용되는 패턴입니다. -> 즉, 문자열에서 특정한 문자를 찾아내는 도구입니다 자바스크립트에서, 정규 표현식은 { 객체 } 입니다. 실제 사용 예시) 1. 이메일 유효성 검사 let regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i; 2 휴대폰 번호 유효성 검사 let regExp = /^01([0|1|6|7|8|9]?)-?([0-9]{3,4})-?([0-9]{4})$/; 정규표현식을 사용하는 방법은 두가지가 있습니다. 1. 리터럴 : 슬래쉬(..
-
Requests 2JavaScript 2021. 12. 15. 15:01
브라우저의 fetch객체를 이용해 서버에 요청을 보내는 방법을 정리하였습니다. AJAX하면 예전에는 XMLHttpRequest(XHR) API를 이용하는 것이 일반적이었으며, 그리고 불편함을 느낀 사람들이 jQuery를 통해 AJAX를 구현하기 시작했고 그 이후로 Fetch API가 ES6(ES2015) 표준으로 등장하면서 이제는 일반적으로 Fetch API를 통해 구현하는 것이 일반적이 되었습니다. Fetch API는 비동기 처리를 구현하기 위해 Promises를 이용하고, 반환값으로 Promise를 가집니다. Fetch API는 브라우저에서 바로 사용 가능합니다.(Fetch is Web API) Reference : MDN - Fet..
-
Requests 1JavaScript 2021. 12. 13. 23:46
바닐라 자바스크립트와 브라우저의 XMLHttpRequest(XHR)객체를 이용해 서버에 요청을 보내는 방법을 정리하였습니다. Have you ever wondered what happens after you click a “Submit” button on a web page? For instance, if you are submitting information, where does the information go? How is the information processed? The answer to the questions revolves around HTTP requests. There are many types of HTTP requests. Th..
-
Async AwaitJavaScript 2021. 12. 13. 08:58
자바스크립트의 Async...await 문법의 개념과 사용방법을 정리하였습니다. The async...await syntax allows us to write asynchronous code that reads similarly to traditional synchronous, imperative programs. Its functionaility is completely same as Promises, but async...await powerfully improves the readability and scalability of our code. Example : callback function(traditional) VS Promises VS async...await ..
-
PromiseJavaScript 2021. 12. 13. 07:28
자바스크립트의 Promise 사용법과 문법을 정리하였습니다. An asynchronous operation is one that allows the computer to “move on” to other tasks while waiting for the asynchronous operation to complete. Asynchronous programming means that time-consuming operations don’t have to bring everything else in our programs to a halt. Example : Operations like making a network request or querying a database can ..
-
Asynchronous / Event LoopJavaScript 2021. 12. 12. 18:40
자바스크립트의 비동기 코드와 이벤트 루프를 이해하기 위해 참고할 만한 자료입니다. https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Concepts General asynchronous programming concepts - Learn web development | MDN In this article, we'll run through a number of important concepts relating to asynchronous programming, and how this looks in web browsers and JavaScript. You sho..
-
Error HandlingJavaScript 2021. 12. 11. 22:59
자바스크립트에서 에러를 다루는 방법을 정리하였습니다. We can’t always stop errors before they occur, but we can include a backup plan in our program to anticipate and respond to the errors to ensure that our program continues running. Error handling is the process of programmatically anticipating and addressing errors. Errors contain useful messages that tell us why..
-
ModulesJavaScript 2021. 12. 11. 00:20
자바스크립트의 Module에 관한 개념 및 문법을 정리하였습니다. Modules are reusable pieces of code in a file that can be exported and then imported for use in another file. This modular strategy is called separation of concerns. Note: The words “module” and “file” are often used interchangably Before we dive in, it should be noted that th..