If otherNode is contained in the node, this value is true otherwise, it is false.Ĭontains() always returns false if the otherNode parameter is null. The Node interface’s includes() method provides a boolean result that indicates if a node is a descendant of a certain node, such as the node itself, one of its direct children (childNodes), one of the children’s direct children, and so on. Working of contains() method in JavaScript Let concatarr = ncat() Ĭoncatarr = ncat() The contains() method in Collect.js is demonstrated in the following examples:Įxample 1: The collect.js library is imported into the file with collect = require(‘collect.js’) Return Value: A boolean value is returned. Parameters: This method takes a single parameter, which is turned into a collection, and then the contains() function takes an item to search. The function is applied to the collection once the JavaScript array is turned into a collection. If the item is present, it returns true otherwise, it returns false. The contains() method is used to check whether or not a collection contains a specific item. There is no structure in JavaScript, the browser executes each line of the code from top to down. Developers are free to write JavaScript language code anywhere and can still run it in the browser. Since JavaScript is a scripting language, it works without any libraries. Adding behavior and functionalities to web pages.Animations and graphics, adding special effects to web components.Building web server and its interactive functions.JavaScript has tons of libraries, one of which is React which we will be covering in this article later. It is also used for making animations on websites and has a large community on GitHub. It allows a web application to be interactive. JavaScript is one of the most used languages when it comes to building web applications as it allows developers to wrap HTML and CSS code in it to make web apps interactive. If you are a beginner and want to learn JavaScript then do check out the course on Codedamn. Hey readers, in this article we will be discussing how to use contains() method in JavaScript in a step-wise, efficient manner.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |