javascript string ends with
"Hello world".endsWith("world");//true
"Hello world".endsWith("Hello");//falsefunction endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
endsWith("hello young man","man");//true
endsWith("hello young man","boy");//false
var str = "Hello world, welcome to the universe.";
var n = str.endsWith("universe.");//returns trueconst s = 'I am going to become a FULL STACK JS Dev with Coderslang';
console.log(s.endsWith('lang')); // true
console.log(s.endsWith('LANG')); // falsefunction solution(str, ending){
return str.indexOf(ending, str.length - ending.length) !== -1;
}
Also in JavaScript:
- import img react in another file
- how to set variable in discord.js
- how to declare a variable js
- denuncia perturbação
- javascript loop through object values
- express ssl
- javascript math.pow
- how to reverse a string in javascript without using reverse method
- javascript sort function
- node downgrade windows
- sort an array by the laster letter of element javascript
- how to get time and date from iso string javascript
- how to add object to array javascript
- array differenc javascript
- node js mongoose text index
- angular 9 change menu link item at runtime
- quicksort javascript
- js onscroll event
- buscar valor maximo y mínimo array jquery
- js 1d index to 2d coord
- angular how to get previous state
- event.target.name in setstate
- javascript degree to radians
- how to validate email in node js