JavaScript Example (Program)
Learn Details

Q. Where do use includes() method ?

जिस किसी array में किसी specific value को check करना हो की वह value किसी array में assign है या नहीं, तो इस condition में include method का use करते हैं. यह हमें Boolean value return करता है

Array.includes (“find_value”)

  • Program Example


    <script> //prog 1
    var a = ["Ram", "Mahesh", "Suresh", "Ganesh", "Ankit"];
    var b = a.includes("Mahesh");
    document.write(b);
    
       
    </script>
    Out Put : true
    <script> //prog 2
    var a = ["Ram", "Mahesh", "Suresh", "Ganesh", "Ankit"];
    var b = a.includes("Ramesh");
    document.write(b);
    
       
    </script>
    Out Put : 1