본문 바로가기

분류 전체보기

Advanced Array Methods(some & every) some: Iterates through an array Runs a callback on each value in the array If the callback returns true for at least one single value, return true Otherwise, return falseThe result of the callback will ALWAYS be a boolean function some(array, callback){for (var i = 0; i return num.toString().split('').some(function(val){ return val[key] === 0; > return val === "0"; });} /*Write a function called..
Advanced Array Methods(filter) filter: Creates a new array Iterates through an array Runs a callback function on each value in the array If the callback function returns true, that value will be added to the new array If the callback function returns false, that value will be ignored from the new array function filter(array, callback){var newArr = [];for(var i = 0; i < array.length; i++){if(callback(array[i], i, array)){newAr..
Advanced Array Methods(map) map: Creates a new array Iterates through an array Runs a callback function for each value in the array Adds the result of that callback function to the new array Returns the new array function map(array, callback){var newArr = [];for(var i = 0; i < array.length; i++){newArr.push(callback(array[i], i, array));}return newArr;} /*Write a function called doubleValues which accepts an array and retu..
Advanced Array Methods(forEach) ForEach: Iterates through an array Runs a callback function on each value in the array returns 'undefined' function forEach(array, callback){for (var i = 0; i < array.length; i++) {callback(array[i], i, array);}} /*Write a function called doubleValues which accepts an array and returns a new array with all the values in the array passed to the function doubledExamples: doubleValues([1,2,3]) // [..
4 Ways AJAX(xhr / fetch / jquery / axios) var url = 'https://ron-swanson-quotes.herokuapp.com/v2/quotes';var quote = document.querySelector("#quote");var xhrbtn = document.querySelector("#xhr");var fetchbtn = document.querySelector("#fetch"); //XHRxhrbtn.addEventListener("click", function(){ var XHR = new XMLHttpRequest(); XHR.onreadystatechange = function (){ if(XHR.readyState == 4 && XHR.status == 200){ var data = JSON.parse(XHR.respo..
Fetch Random User Profile Generator 코드리뷰 Udemy The Advanced Web Developer Bootcamp에서는 프로젝트 중심으로 강의를 진행하고있다. 강의를 한번듣고 바로 좋은 코드를 작성하진 못하지만 이런 리뷰를 통해서 코드에 대한 이해도가 더 생겼으면 좋겠다.1var url = "https://randomuser.me/api";1var url = 'https://randomuser.me/api/';2var name = document.querySelector("#fullname");2var fullnameDisp = document.querySelector("#fullname");3var img = document.querySelector("#avatar");3var avatar = document.querySelector("#a..
AJAX XHR(XML HTTP Request) var btn = document.querySelector("button");var display = document.querySelector("#price");var currency = "USD"; btn.addEventListener("click", function(){var XHR = new XMLHttpRequest(); fetch(url) XHR.onreadystatechange = function(){ .then(function(response){ if(XHR.readyState == 4 && XHR.status == 200){ return response.json() var data = JSON.parse(XHR.responseText); }) var ..
Async Foundation Callback function: a function that is passed into another function as a parameter then invoked by that other function(usecases: Advanced Array Methods, Broswer events, AJAX Requests, React Development) A higher order function: a function that accept a callback as a parameter Use a callback function to make your code more general Create callbacks using anonymous functions Foreach function: functi..
비전공자 웹개발자로서 살아남는 법 정리본(출처:okky) https://okky.kr/article/372485 원문 링크 입니다. 아래의 내용은 원문과 댓글을 참조해서 개인적으로 편집한 내용입니다. (중요도순으로 번호)(1) 네트워크(웹서버포함) 네트워크는 매우 중요합니다. 신입한테는 운영체제와 컴퓨터 사이언스에 대한 지식보다 중요하다고 전 개인적으로 생각합니다. 데이터가 어떻게 라우터를 통해 넘어다니고 하는 것까지는 모르더라도, 웹브라우저(클라이언트)와 웹서버(서버) 사이에서 일어나는 흐름들, http 프로토콜에 따라 데이터가 헤더와 바디에 담겨서 넘나드는 흐름을 정확히 이해하고 있는가 아닌가는, 기초적인 코딩 응용력을 결정짓는 중요한 요소라고 생각합니다. 보통 여기선 웹 서버 하나 정해놓고 공부를 하는 게 도움이 됩니다.(apache 또는 nginx 등)..
내가 잘 하고 있는 것일까라는 생각 취직 쉽고 월급 많다는 소문에...문과생들 앞다퉈 컴퓨터 학원·프로그래밍 동아리로https://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=105&oid=015&aid=0004090302 고시원에만 있다보면 바깥세상이 궁금해서 매일 뉴스를 보는 습관이 생긴 것 같다. 20대 초반 공무원준비를 하며 흘려보낸 시간이 너무 아까웠다. 그 때는 내가 하고싶었던 일도 몰랐고, 내가 좋아하는 것도 몰랐다. 그래서 열정 또한 없었다. 이후로 이런 시간들을 또 다시 보내고 싶진 않았다. 그래서 가장 먼저 시작했던 일은 내가 좋아하는 것을 찾기 위해 시간을 썼다.외국에서 살아보고 여행도 다니며 이것 저것 경험해보면서 내가 좋아하는 것을 찾고 싶었다. 이런 노력끝에 내가 좋아..