Javascript did not always support multi-line strings. If you attempted to create a string variable using quotes, putting a line break into the source code would result in a syntax error. Recent updates to the language have added support for multi-line strings in Javascript. This…
The HTML 5 Canvas has to be one of the coolest features that has been introduced in quite some time. Solid and well built, it makes image editing and modification such a breeze compared to the javascript-based tools we had in the past. There are…
Performing analysis on content that a user is typing is a common requirement for interfaces. A simple word counter, for example, will need to bind to an event so that it can scan the text when the user has modified the data. There are ways…
I have a json string that is a regular raw string and job a javascript object. How do i load this json into a javascript object so that I can use it normally?  var jsonStr = "{\"property1\": \"test\", \"property2\": \"something else\" }"; alert(loadedJson.property1); The example…
Calculating the length of a string is a very simple thing to do in most programming languages. It is an action that you will find yourself needing to perform very often. Be it for validation, reporting or comparisons, knowing how to find how many characters…
I am using JsPDF and I want to add an image to a pdf document. I have followed the examples from the code and it seems fairly simple to make it work. For some reason I am getting a console error when I try to…
I have a canvas window and there is an element that i want to programmatically add to it. If a user adds a background image, i want to be able to toggle a semi transparent overlay that makes the text above stand out more clearer…
I have an array of items where they are key value pairs. I want to select one at random, but I do not know how to get the key for a random item in the array. I can use Math.random() to generate a random index…