JavaScript Shorts - 9 | Strings Properties & Methods - length, slice, substring, substr | #strings

preview_player
Показать описание
JavaScript Shorts - 9 | Strings Properties & Methods - length, slice, substring, substr | #strings #javascript | @MindCodeTerux

1. Property: length
Description: Returns the length of a string
Example:
let text = "JavaScript";

2. Method: slice(start, end)
Description: Extracts a part of a string
Example: "Hello".slice(1, 4)
Output: "ell"

3. Method: substring(start, end)
Description: Similar to slice(), but doesn’t accept negative indices
Example: "JavaScript".substring(4, 10)
Output: "Script"

4. Method: substr(start, length)
Description: Extracts a portion of a string based on length
Example: "JavaScript".substr(4, 6)
Output: "Script"

Example:
let str = "Hello, JavaScript!";

---------------************------------------

*** Shorts Made By Using Canva
*** Music
Artist Name: "Cumbia Deli"
Track Name: "Olas de Trap"
Source: "Youtube Audio Library"
Music License: "Youtube Audio Library"
Рекомендации по теме
welcome to shbcf.ru