Udemy 썸네일형 리스트형 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.. 이전 1 2 다음