LoginSignup
0
1

More than 5 years have passed since last update.

ES6入門まとめ

Posted at

ES6

ES6は別名ES2015と呼ばれます。
今回は、ES6の入門部分を学習した際の気になった点をまとめました。

計算

//%を用いると割った際の余りの数字を示せる。この場合は余り1。
console.log(9%2);
//文字列を結合して表示するやり方。Iloveyouと表示する場合。
console.log("I"+"love"+"you");
//数字も結合して表示できます。2018と表示する場合。
console.log("20"+"18");

変数・定数の表記


//letは変数を定義する
//変数名が二文字以上の場合は大文字で区別する。
let secondName = "John";
console.log(secondName);
//constは定数を定義する

if文の表記

//3の倍数であれば3の倍数であることを表記する
 if(number % 3===0){
    console.log("3の倍数です");
  }else{
    console.log(number);
  }

配列

const animal1 = "dog";
const animal2 = "cat";
const animal3 = "snake";
//配列として表す場合
const animals = ["dog", "cat", "snake"];
0
1
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
1