0
0

More than 3 years have passed since last update.

【jquery】includesの使い方 指定した要素が格納されているか判定する

Posted at

jQuery

<!DOCTYPE html>
<html lang="ja">
<head>
   <meta charset="UTF-8">
   <title>serializeArray_01_jq</title>
   <script src="jquery-3.6.0.min.js"></script>
   <script>
    $(function () {
      var myarray = [1,2,3,4,5];
      var res1 = myarray.includes(3);
      var res2 = myarray.includes(7);
      console.log(res1)
      console.log(res2)
    });
  </script>

出力結果

true
false
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