The includes() Method in JavaScript | Checking if a String Contains Text
How do you check if a string contains a given word or character? That's exactly what JavaScript's includes() method is for.
In this lesson, we'll explore how includes() works, what it returns, why it's better than indexOf(), and how to apply it to real-world tasks like searching a list, checking email addresses, and filtering data.
---
Timecodes:
00:00 - Introduction: The purpose of the includes() method and return values (true/false)
00:45 - Historical context: How substring searches were performed before ES2016 using indexOf
01:10 - Comparison of the old (indexOf) and new (includes) syntax in the code editor
01:59 - Simple examples of the method (true if the word is present, false if it is not)
02:22 - Detailed analysis of the method syntax and structure (string, access operator, arguments)
03:10 - Parsing the required searchString parameter (the substring to search for)
03:33 - Parsing the optional position parameter (the index to start the search)
04:13 - Mnemonics for remembering the method call structure
04:29 - Examples of checking various substrings on the string "Hello World"
04:54 - An important interview trap: searching for empty strings strings in includes()
05:16 - Method Predictability: Returning Only Boolean Data Types
05:59 - A Detailed Analysis of Working with the Second Position Parameter Using an Email Address as an Example
07:10 - The Peculiarity of Passing a Negative Value to the Position Parameter
07:35 - Pitfall #1: Method Case Sensitivity (Uppercase and Lowercase)
08:36 - Solving the Case Problem: Converting Strings to Lowercase with toLowerCase() in VS Code
10:48 - Why It's Common to Normalize Strings to Lowercase
11:00 - Pitfall #2: Argument Data Types and Implicit Conversion in JavaScript
11:57 - A Safer Approach: Explicit Type Conversion with the String() Function
13:17 - Final Cheat Sheet: Summary, Dos and Don'ts
14:13 - Conclusion and Announcement of the Practical Video
---
📌 Full FlexBox CSS Course:
👉 / 1320002
📌 Full JavaScript Course:
👉 • JavaScript уроки для начинающих с нуля: По...
📌 JavaScript Practice:
👉 • JavaScript для начинающих: Практические за...
📌 Full CSS Course:
👉 • Полный курс CSS с нуля | Основы CSS для на...
📌 Full HTML Course:
👉 • HTML уроки для начинающих с нуля: Полный курс
---
💬 Telegram:
👉 https://t.me/TopchiyDev
🎓 Patreon:
👉 / topchiydev
---
#stringmethods #javascript_lessons #learningjavascript #javascript #js #includes #javascripttutorial #frontend #webdevelopment #jsfromscratch #javascriptforbeginners #stringmethods
En esta página del sitio puede ver el video en línea includes() Method in JavaScript | Checking for Text in a String de Duración hora minuto segunda en buena calidad , que subió el usuario Topchiy Dev 18 mayo 2026, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 89 veces y le gustó 10 a los espectadores. Disfruta viendo!