কম্পিউটার

জাভাস্ক্রিপ্টে TypedArray.includes() ফাংশন


TypedArray অবজেক্টের অন্তর্ভুক্ত() ফাংশন একটি মান গ্রহণ করে এবং এই টাইপ করা অ্যারেতে নির্দিষ্ট উপাদান রয়েছে কিনা তা যাচাই করে। যদি অ্যারেতে প্রদত্ত উপাদান থাকে তবে এটি সত্য ফেরত দেয় অন্যথায়, এটি মিথ্যা ফেরত দেয়।

সিনট্যাক্স

এর সিনট্যাক্স নিম্নরূপ

typedArray.includes()

উদাহরণ

<html>
<head>
   <title>JavaScript Array every Method</title>
</head>
<body>
   <script type="text/javascript">
      var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]);
      document.write("Contents of the typed array: "+int32View);
      document.write("<br>");
      var contains = int32View.includes(66);
      if(contains) {
         document.write("Array contains the specified element");
      }else {
         document.write("Array doesn’t contains the specified element");
      }
   </script>
</body>
</html>

আউটপুট

Contents of the typed array: 21,19,65,21,14,66,87,55
Array contains the specified element

উদাহরণ

<html>
<head>
   <title>JavaScript Array every Method</title>
</head>
<body>
   <script type="text/javascript">
      var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]);
      document.write("Contents of the typed array: "+int32View);
      document.write("<br>");
      var contains = int32View.includes(762);
      if(contains) {
         document.write("Array contains the specified element");
      }else {
         document.write("Array doesn’t contains the specified element");
      }
   </script>
</body>
</html>

আউটপুট

Contents of the typed array: 21,19,65,21,14,66,87,55
Array doesn’t contains the specified element

  1. জাভাস্ক্রিপ্টে TypedArray.reverse() ফাংশন

  2. জাভাস্ক্রিপ্ট অ্যারে ফিল() ফাংশন

  3. JavaScript Array.of() ফাংশন

  4. JavaScript array.includes() ফাংশন