There was indeed an error in our documentation. It's fixed now, thanks for letting us know.
So you can use it as
var trueOrFalse = b.startsWith( yourWord, yourSearchToken );
Question
I was wondering how the syntax of the b.startsWith() function in basil.js is supposed to look.
I want to check all words of a text to see, if they start with the string 'some' (like 'sometimes', 'something', 'someone', 'somewhere' etc.).
So, I create a variable that passes on every word of my text to the b.startsWith() function.
When I put the string I am searching for in the brackets ( b.startsWith(some) ), then where exactly will I have to put the variable that will be checked if it starts with my 'some'-string?
La solution 2
There was indeed an error in our documentation. It's fixed now, thanks for letting us know.
So you can use it as
var trueOrFalse = b.startsWith( yourWord, yourSearchToken );
Autres conseils
It looks like their documentation has some errors. It shows the function signature as you have described:
b.startsWith(str)
But if you look at the code where the function is defined it looks like this:
var startsWith = pub.startsWith = function(str, prefix) {
return str.indexOf(prefix) === 0;
};
The first argument is the string to search through, and the second argument is the string to search for.