Compare two dates with JavaScript

The Date object will do what you want – construct one for each date, then compare them using the >, <, <= or >=. The ==, !=, ===, and !== operators require you to use date.getTime() as in to be clear just checking for equality directly with the date objects won’t work I suggest you use drop-downs or some similar constrained form of date entry rather than text boxes, … Read more

Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function

The 500 code would normally indicate an error on the server, not anything with your code. Some thoughts Talk to the server developer for more info. You can’t get more info directly. Verify your arguments into the call (values). Look for anything you might think could cause a problem for the server process. The process … Read more

How to play audio?

If you don’t want to mess with HTML elements: Show code snippet This uses the HTMLAudioElement interface, which plays audio the same way as the <audio> element. If you need more functionality, I used the howler.js library and found it simple and useful. Show code snippet

JavaScript equivalent to printf/String.Format

Current JavaScript From ES6 on you could use template strings: See Kim’s answer below for details. Older answer Try sprintf() for JavaScript. If you really want to do a simple format method on your own, don’t do the replacements successively but do them simultaneously. Because most of the other proposals that are mentioned fail when a replace string … Read more