0
I would like to know if there is a php strpos() error function in javascript on mainly for the Node.js environment and would like to know how to use it.
0
I would like to know if there is a php strpos() error function in javascript on mainly for the Node.js environment and would like to know how to use it.
1
Trelhac, the closest function to PHP strpos in javascript is the index, where it returns an integer relative to the position of the searched string:
let valor = "Teste";
//Vai encontrar o valor
console.log(valor.indexOf("Tes"));
//Não vai encontrar o valor
console.log(valor.indexOf("tes"));
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
In case you want to check only the contained, it is worth taking a read also on the includes:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
Browser other questions tagged javascript node.js
You are not signed in. Login or sign up in order to post.
have how I use this in if?
– trelhac
Here is an example: https://repl.it/repls/ProudDescriptiveDiscussions
– Daniel Mendes