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 1 year has passed since last update.

JavaScriptのビルトインオブジェクト

Last updated at Posted at 2022-12-22

JavaScriptではたくさんのオブジェクトが元から用意されている。
ほぼ全ての値はこれを利用して作られたもの。

例えば、

console.log()

は分解すると
consoleオブジェクトのlogメソッド。
consoleに紐づく様々なメソッドが用意されており、それを使っている。

const str = 'hello';

console.log(str.length);
console.log(str.toUpperCase());

//5
//HELLO

Mathオブジェクト

ex) Mathオブジェクトのroundメソッドを利用して50~100までのランダムな値を取得する

const generateRoundNum = (start, end) =>  Math.round(start + Math.random() * (end - start));
console.log(generateRoundNum(50, 100));

Dateオブジェクト

※Dateオブジェクトを使うときはnewを使う

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?