Javascript

binest03459·2022년 4월 4일
0

Javascript

목록 보기
2/16
post-thumbnail

Programming

Programming is the task of describing the requirements in detail and accurately to the extent that machines that know only 0 and 1 can execute. The result is a code. When coding, logical and mathematical thinking is required. All concepts used in programming must be defined to enable quantification, segmentation, patterning, and solution extraction. This is called "Computer Thinking.”


Programming Language

Programming language is a language composed of promised Syntax and Semantics that humans can understand. After writing a program using the programming language, Compiler and Interpreter convert it into machine language.


Syntax & Semantics

When writing a programming language, Not only do we make sentences that fit Syntax, but we also need Semantics to ensure the role of programming language.

In other words, it is meaningful only when requirements are fulfilled and problems are resolved.


Javascript

Javascript is one of the components of the web, along with HTML and CSS, and is the only programming language running in a web browser.

Javascript is an interpreter language in which developers do not perform separate compiling tasks.

Javascript is a multi-paradigm programming language that supports Imperative, Functional, and prototype-based Object-oriented programming.



Fun Fact

If you put a null value in the typeof operator, you get an object instead of null. This is a design error in JavaScript. When JavaScript tried to correct the error again, it decided to leave it unattended because it was already being used by too many browsers.

Therefore, the typeof operator should not be used when checking the null type, but the matching operator (===) should be used.



Funtion-level scope

Variables declared inside the function are local variables, and
Variavles declared outside the function are global variables.

Block-level scope

Variables declared within the code block are vaild only within the code block and cannot be referenced outside the code block.

Problems with var declaration

Function-level scope

  • Overuse of global variables
  • Variables used in the for loop initialization formula can be referenced outside or globally.

Allow var keyword to be omitted

  • Declare Variables unintentionally

Allow duplicate declarations

  • Unintended change of Variables

Hoisting Variables

  • Reference is available before declaring a Variables

-> To solve the problems of var, let and const were introduced.



Assignment Operator

Assignment Operatorexamplesame expression
=x=yx=y
+=x+=yx=x+y
-=x-=yx=x-y
*=x*=yx=x*y
/=x/=yx=x/y
%=x%=yx=x%y


Ternary Operator

condition ? exprIfTrue : exprIfFalse

profile
Footprints in Coding

0개의 댓글