Programming/JavaScript (65) 썸네일형 리스트형 The JavaScript Engine and Runtime Step 1. Parsing = Read the code Parsing 과정동안 Abstract Syntax Trees (AST) data structure로 parse됨 Step 2. Compilation Generated AST compiled to machine code Step 3. Execution machine code는 after compilation right away 바로 실행됨 due to JIT compilation very unoptimized code in the begginning -> optimization 과정을 거침 (during execution) 이 과정을 여러번 거치기도 함 각 최적화 과정 후에는 이전의 unoptimized code가 더 optimized된 코드로 .. Execution Contexts and the Call Stack Execution context is an environment in which a piece of JavaScript is executed. Stores all the necessary information for some code to be executed. 비유하자면 피자를 JavaScript code라고 치고 피자가 담긴 박스를 Pizza execution context인 셈 이 박스에는 포크, 소스 등 피자 먹는데 필요한 모든게 다 담겨 있음 => execution context에는 코드를 실행하는데 필요한 모든게 담겨 있다. Exactly one global execution context (EC): Detault context, created for code that is not inside.. What is a JavaScript Engine? a JavaScript Engine is a computer program that executes javascript code. E.g. V8 Engine JS Engine 항상 이 2개를 포함함 CALL STACK: where our code is actually executed using execution context HEAP: where objects are stored e.g. object in memory Compilation vs. Interpretation Compilation: Entire code is converted into machine code at once, and written to a binary file that can be executed by a computer. S.. Coding Challenge #1 - Developer Skills (feat. Problem solving) Tried 결과 값은 나오는데 Console에 한줄에 어떻게 프린트할지에서 막힘 😥 // step 1. create a function 'printForecast' // step 2. how to take an array as an argument of the function // step 2-2. how to log on console in the same line // console을 매 array value마다 찍지 말고 결과 값을 another array에 담아야 하나? // step 3. how to log a string like the example to the console const arrOne = [17, 21, 23]; function printForecast(arr) { for (l.. An High-Level Overview of JavaScript High-level Any computer program needs resources such as memory and CPU LOW-LEVEL language such as C -> Developer has to manage resources manually vs. HIGH-LEVEL languages such as JS, Python -> No need to manage. Everything happens automatically Garbage-collected Cleaning the memory so we don't have to Interpreted or just-in-time compiled Computer는 본래 zero or one만 이해할 수 있음 -> machine code that's .. Coding Challenge #4 - arrays for the tips and the totals Tried 👏👏👏 const bills = [22, 295, 176, 440, 37, 105, 10, 1100, 86, 52]; const tips = []; const totals = []; const calcTip = function (billValue) { if (billValue >= 50 && billValue Looping Backwards and Loops in Loops const sunnyArray = [ 'Sunny', 'Ryu', 2022 - 1988, 'technical writer', ['Writing', 'Coding', 'Learning'] ]; // 4, 3, ..., 0 for (let i = sunnyArray.length - 1; i >= 0; i--) { console.log(sunnyArray[i]); } sunnyArray.length 이 방법이 더 좋은 이유는 배열에 값이 몇 개 있는지 일일히 세서 하드코딩할 필요 없다는 것! 🙅♀️ Loops in Loops for (let exercise = 1; exercise The while Loop let rep = 1; while (rep Looping Arrays, Breaking and Continuing const sunnyArray = [ 'Sunny', 'Ryu', 2022 - 1988, 'technical writer', ['Writing', 'Coding', 'Learning'] ]; for (let i = 0; i < sunnyArray.length; i++) { console.log(sunnyArray[i]); } console.log(sunnyArray[i], typeof sunnyArray[i]); const types = []; for (let i = 0; i < sunnyArray.length; i++) { // Reading from sunny array console.log(sunnyArray[i], typeof sunnyArray[i]); // Filling types array .. Iteration: The for Loop for (let repetition = 1; repetition 이전 1 2 3 4 5 ··· 7 다음