1
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 5 years have passed since last update.

【備忘録】Progate JavaScript 1,2 まとめ

Posted at

##プログラムを実行

console.log("Hello World!");
console.log(1+2);
console.log("1+2");

結果:
Hello World!
3
1+2

##文字列の連結

console.log("こんにちは"+"世界");

結果:
こんにちは世界

##変数の定義

let name = "Tanaka";
console.log(name);
name = "Suzuki";
console.log(name);

結果:
Tanaka
Suzuki
//letによる変数宣言は後に更新可能
---------------------------------

const name = "Tanaka";
console.log(name);
name = "Suzuki";
console.log(name);

結果:
Tanaka
Tanaka
//constによる変数宣言は後に更新不可

##テンプレートリテラル

const name = "Tanaka";
console.log(`My name is ${name}.`);

結果:
My name is Tanaka.

//`文字列${変数}`で「+」と同等の役割

##条件分岐

const number = 18
if (number > 10){
  console.log('Number is greater than 10.');
}

結果:
Number is greater than 10.
-------------------------------------

const number = 18
if (number > 20){
  console.log('Number is greater than 20.');
} else {
  console.log('Number is smaller than 20.');
}

結果:
Number is smaller than 20.
1
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
1
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?