Understanding Case Sensitivity in Variables
In JavaScript all variables and function names are case sensitive. This means that capitalization matters. MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.
camelCase
Write variable names in JavaScript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.
Parameter
Parameters are variables that act as placeholders for the values that are to be input to a function when it is called. When a function is defined, it is typically defined along with one or more parameters. The actual values that are input (or "passed") into a function when it is called are known as arguments.
Global Scope and Functions
In JavaScript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means, they can be seen everywhere in your JavaScript code. Variables which are declared without the let or const keywords are automatically created in the global scope. This can create unintended consequences elsewhere in your code or when running a function again. You should always declare your variables with let or const.
Local Scope and Functions
Variables which are declared within a function, as well as the function parameters, have local scope. That means they are only visible within that function.
Understanding Undefined Value returned from a Function
A function can include the return statement but it does not have to. In the case that the function doesn't have a return statement, when you call it, the function processes the inner code but the returned value is undefined.
+ add
- subtract
* multiply multiplies 3 by 5
/ divide ( quotien: 몫)
% remainder
increment 증가 i++;
decrement 감소 i--;
decimal number 소수
parentheses 소괄호 ()
curly braces 중괄호 {}
precedence = priority 우선순위 a takes precedence over b : a가 b보다 우선순위를 갖다
'부트캠프 개발일지 2023-2024 > Algorithm 알고리즘' 카테고리의 다른 글
[Programmers] 알고리즘 : 자릿수 더하기 (1) | 2023.11.13 |
---|---|
[Programmers] 알고리즘 : 평균 구하기 (0) | 2023.11.08 |
[Programmers] 알고리즘 : 짝수와 홀수 (0) | 2023.11.08 |
[Programmers] 알고리즘 : 배열의 평균값 (0) | 2023.11.08 |
[FCC] JS algorithms and Data Structures - Functional Programming - Use the map Method to Extract Data from an Array (0) | 2023.10.26 |