Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@sssttt

JavaScriptメモ

More than 1 year has passed since last update.

.test

regexp.test(str)

regexp: 正規表現、str:チェックしたい文字列

与えられた文字列を検索し、その結果はtrue/falseで返す

const required = val => !!val.trim()

以下と同じ意味

const required = function (val) {
   return !!val.trim() //trim()はvalの前後の空白を取り除く
}

Object.keys

オブジェクトのキーだけを配列で取得

const object1 = {
  a: 'somestring',
  b: 42,
  c: false
};

console.log(Object.keys(object1));
// expected output: Array ["a", "b", "c"]

.find

提供されたテスト関数を満たす配列内の最初の値を返す。

var array1 = [5, 12, 8, 130, 44];

var found = array1.find(function(element) {
  return element > 10;
});

console.log(found);
// expected output: 12
0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
sssttt

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?