{"id":2459,"date":"2022-01-02T22:05:27","date_gmt":"2022-01-02T19:05:27","guid":{"rendered":"https:\/\/www.etemkeskin.com\/?p=2459"},"modified":"2022-01-02T22:18:20","modified_gmt":"2022-01-02T19:18:20","slug":"includes-method-in-javascript","status":"publish","type":"post","link":"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/","title":{"rendered":"includes() Method in Javascript"},"content":{"rendered":"\n<p>In Javascript, There is <code>includes()<\/code> powerful method which is separately used in<strong> array<\/strong> and <strong>string <\/strong>expressions.<\/p>\n\n\n\n<h3>includes() Method at string expressions:<\/h3>\n\n\n\n<p><strong>Usage:<\/strong> str.includes(<em>searchvalue<\/em>,<em>&nbsp;start<\/em>)<\/p>\n\n\n\n<p><strong>includes()<\/strong> method returns<strong> true <\/strong>if string expression has specified value. includes() method is case sensitive.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;JavaScript&quot;,&quot;modeName&quot;:&quot;js&quot;}\">let text = &quot;My name is etem, this website awesome.&quot;;\nlet result = text.includes(&quot;etem&quot;);\nconsole.log(result); \/\/ Output: true\nresult = text.includes(&quot;Etem&quot;);\nconsole.log(result); \/\/ Output: false<\/pre><\/div>\n\n\n\n<h3>includes() Method at array expressions:<\/h3>\n\n\n\n<p><strong>includes()<\/strong> method returns <strong>true<\/strong> if array has specified value. <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;JavaScript&quot;,&quot;modeName&quot;:&quot;js&quot;}\">const array1 = [1, 2, 3];\nlet result = array1.includes(2);\nconsole.log(result); \/\/ Output: true\nresult = array1.includes(5);\nconsole.log(result); \/\/ Output: false\narray1.includes(3, -1)\nconsole.log(result); \/\/ Output: true<\/pre><\/div>\n\n\n\n<p>When using at array expressions, <strong>includes() <\/strong>method can take negative value as second parameter.<\/p>\n\n\n\n<p>Good luck&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Javascript, There is includes() powerful method which is separately used in array and string expressions. includes() Method at string expressions: Usage: str.includes(searchvalue,&nbsp;start) includes() method returns true if string expression has specified value. includes() method is case sensitive. includes() Method at array expressions: includes() method returns true if array has specified value. When using at [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[50],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>includes() Method in Javascript - blog website<\/title>\n<meta name=\"description\" content=\"There is a method to use the Javascript includes() method separately in array and string expressions.includes() Method at string expressions:Usage: str.includes(searchvalue,\u00a0start)includes() method returns true if string expression has specified value. includes() method is case sensitive.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"includes() Method in Javascript - blog website\" \/>\n<meta property=\"og:description\" content=\"There is a method to use the Javascript includes() method separately in array and string expressions.includes() Method at string expressions:Usage: str.includes(searchvalue,\u00a0start)includes() method returns true if string expression has specified value. includes() method is case sensitive.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"blog website\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-02T19:05:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-02T19:18:20+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.etemkeskin.com\/#website\",\"url\":\"https:\/\/www.etemkeskin.com\/\",\"name\":\"blog website\",\"description\":\"Etem KESK\\u0130N\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.etemkeskin.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"tr\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/#webpage\",\"url\":\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/\",\"name\":\"includes() Method in Javascript - blog website\",\"isPartOf\":{\"@id\":\"https:\/\/www.etemkeskin.com\/#website\"},\"datePublished\":\"2022-01-02T19:05:27+00:00\",\"dateModified\":\"2022-01-02T19:18:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.etemkeskin.com\/#\/schema\/person\/dcbc30282861ce578b96a79ce8789629\"},\"description\":\"There is a method to use the Javascript includes() method separately in array and string expressions.includes() Method at string expressions:Usage: str.includes(searchvalue,\\u00a0start)includes() method returns true if string expression has specified value. includes() method is case sensitive.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/2022\/01\/02\/includes-method-in-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Ana sayfa\",\"item\":\"https:\/\/www.etemkeskin.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"includes() Method in Javascript\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.etemkeskin.com\/#\/schema\/person\/dcbc30282861ce578b96a79ce8789629\",\"name\":\"etemkeskin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.etemkeskin.com\/#personlogo\",\"inLanguage\":\"tr\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6af0148b790691ed24ae245fb3dc773b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6af0148b790691ed24ae245fb3dc773b?s=96&d=mm&r=g\",\"caption\":\"etemkeskin\"},\"url\":\"https:\/\/www.etemkeskin.com\/index.php\/author\/etemkeskinyahoo-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/2459"}],"collection":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/comments?post=2459"}],"version-history":[{"count":23,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/2459\/revisions"}],"predecessor-version":[{"id":2492,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/2459\/revisions\/2492"}],"wp:attachment":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/media?parent=2459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/categories?post=2459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/tags?post=2459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}