0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JavaScript メモ :定数、変数

Posted at

定数

プログラムの中で値に付けられる名前のこと

・定数を作るには、constとというキーワードの後に定数名を書いて、定数を使いますよと宣言する必要がある。
例)const price = 200;
・上記の=(イコール)は右の値に左の値を当てはめるという意味。これを代入という。
・再代入できない。

変数

・変数を作るには、letもしくはvarとというキーワードの後に変数名を書いて、変数を使いますよと宣言する必要がある。
・再代入できる。
例)
let prece =100;
console.log(price * 10);
console.log(price * 20);

price = 150;(再代入)
console.log(price * 10);
console.log(price * 20);

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?