DEV Community

mmvergara
mmvergara

Posted on • Edited on

1

Javascript Tagalog - String endsWith Method

Ano ngaba ang String endsWith Method sa Javascript?
yung endsWith method sa javascript ay mag rereturn ng Boolean Value (true or false) depende if yung string is nag e-end sa binigay mong string as an argument

Pano gamitin:
First Argument
yung first argument ay yung string na gusto mo tignan if

x = 'mm vergara'

console.log( x.endsWith('vergara') ) // TRUE

console.log( x.endsWith('ara') ) // TRUE

console.log( x.endsWith('mm') ) // FALSE

Enter fullscreen mode Exit fullscreen mode

Second Argument (optional)
yung second argument is mag dedetermine kung ano length ng string mo, by default yung length is yung length ng string mo (in this ex. is 10).

  • if gusto mo i cut yung string babaan mo yung length using the 2nd argument. tignan monalang pics para magets mo.
//lenght of string is 10
x = 'mm vergara'

// Searching sa "mm vergara"
console.log( x.endsWith('vergara') ) // TRUE

// Searching sa "mm vergar"
console.log( x.endsWith('vergara',9) ) // False

// Searching as "mm verg"
console.log( x.endsWith('vergara',7) ) // False
Enter fullscreen mode Exit fullscreen mode

More tagalog Javascript Learning Resources:
https://javascript-methods-in-tagalog.vercel.app/

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more