Reputation: 65
I've been writing some JavaScript code, and introduced this small function:
function decodeLink(thelink) {
console.log(typeof(thelink)); // Reports 'string'
if (thelink.contains("something")) {
// Cool condition
}
}
However, if I was to call decodeLink("hello");
, I get this error:
TypeError: thelink.contains is not a function
Note that I'm using node.js and discord.js, however commenting the imports out yields no results.
I've been using to the strongly typed C# style of programming, this weak typing is quite new to me. I'm sure I've missed something important (such as some explicit way to tell the program it's dealing with a string), but no search lead me closer as to what...
Upvotes: 2
Views: 2286