JavaScript
https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Unofficial_JavaScript_logo_2.svg/200px-Unofficial_JavaScript_logo_2.svg.png
Points
arrow function
constant scope
constructor override
default export, named export
forEach, find, filter, map method
Type of variable declaration
There are three ways to declare variables in javascript.
var
not recommend
let
変数
const
定数
var
code:js
var hoge_var = 10;
var hoge_var = 100; // redeclarable
hoge_var = 1000; // reassignable
let
code: js
let hoge_let = 20;
let hoge_let = 200; // cannot be redeclared
hoge_let = 2000; // reassignable
const
code:js
const test_const = 30;
const test_const = 300; // cannot be redeclared
test_const = 3000; // cannot be reassigned
scope
global variables
local variables
global variables
Since global variables can be accessed from anywhere, it is easy to cause conflict with other variables.
Therefore, an error may occur or the output may not be performed as expected.
local variables
Variables used only in for statements and functions
Reference