Skip to content

Tag: methods

why js can’t run method as a function

javascript error: Uncaught TypeError: Array.prototype.indexOf called on null or undefined but this works And in python. This works. So why the first way failed? Answer indexOf requires a this value of an array. Passing is the same as passing Array.prototype.indexOf: A similar one: Passing it as a callback ins…

multiple conditions for JavaScript .includes() method

Just wondering, is there a way to add multiple conditions to a .includes method, for example: Imagine the comma states “or”. It’s asking now if the string contains hello, hi or howdy. So only if one, and only one of the conditions is true. Is there a method of doing that? Answer That should …

Details about window.stop()

I just came across the window.stop() The stop() method is exactly equivalent to clicking the stop button in the browser. Because of the order in which scripts are loaded, the stop() method cannot stop the document in which it is contained from loading, but it will stop the loading of large images, new windows…