Study
-
What are other uses of functions as data?Study/JavaScript 2020. 5. 2. 14:14
https://discuss.codecademy.com/t/what-are-other-uses-of-functions-as-data/376842 What are other uses of functions as data? Question In this exercise, the example of shortening a long function name to a short name is given as an application of using functions as data. In particular, we are given this example is2p2 = checkThatTwoPlusTwoEqualsFourAMillionTimes; This example seems discuss.codecademy..
-
for문과 while문의 차이점Study/JavaScript 2020. 5. 1. 21:25
while문과 do-while문의 차이점은 조건을 먼저 검사하느냐 나중에 검사하느냐일 뿐 동작 방식은 동일합니다. 반복횟수를 알고 있을 때 주로 사용한다. for문이 정해진 횟수만큼 반복한다면, while 문은 조건식이 true 일 경우에 계속해서 반복합니다 So you may be wondering when to use a while loop! The syntax of a for loop is ideal when we know how many times the loop should run, but we don’t always know this in advance. Think of eating like a while loop: when you start taking bites, you don’t know..
-
what is Scope?Study/JavaScript 2020. 4. 30. 20:03
Scope An important idea in programming is scope. Scope defines where variables can be accessed or referenced. While some variables can be accessed from anywhere within a program, other variables may only be available in a specific context. You can think of scope like the view of the night sky from your window. Everyone who lives on the planet Earth is in the global scope of the stars. The stars ..
-
What are the advantages of function expressions? 함수표현식 vs 함수 선언식Study/JavaScript 2020. 4. 30. 13:05
함수 선언식은 호이스팅에 영향을 받지만, 함수 표현식은 호이스팅에 영향을 받지 않는다. 함수 선언식은 코드를 구현한 위치와 관계없이 JS의 특징인 호이스팅에 따라 브라우저가 js를 해석할 때 위로 끌어 올려진다. 예를들어, 아래의 코드를 실행할 때, //실행 전 logMessage(); sumNumbers(); function logMessage(){ return 'worked'; } let sumNumbers = function() { return 10 + 20; }; 호이스팅에 의해 자바스크립트 해석기는 코드를 아래와 같이 인식한다. //실행 시 function logMessage(){ return 'worked'; } let sumNumbers; logMessage(); // 'worked' sum..
-
Why do I need to use `return`?Study/JavaScript 2020. 4. 30. 12:10
Why do I need to use `return`? Why do I need to use `return`? This lesson is so wrong. lol. I believe the tasks are backwards. Why do I have to use the return keyword before declaring the variables, in this case numOfMonitors? The examples wasn’t like that. discuss.codecademy.com
-
Parameters and ArgumentsStudy/JavaScript 2020. 4. 29. 20:53
Parameters and Arguments So far, the functions we’ve created execute a task without an input. However, some functions can take inputs and use the inputs to perform a task. When declaring a function, we can specify its parameters. Parameters allow functions to accept input(s) and perform a task using the input(s). We use parameters as placeholders for information that will be passed to the functi..
-
js 로 Magic Eight Ball 만들기Study/JavaScript 2020. 4. 29. 18:58
Magic Eight Bal lYou’ve learned a powerful tool in JavaScript: control flow! It’s so powerful, in fact, that it can be used to tell someone’s fortune.In this project we will build the Magic Eight Ball using control flow in JavaScript.The user will be able to input a question, then our program will output a random fortune.If you get stuck during this project or would like to see an experienced de..