JavaScript
JavaScript
JavaScript
Type hints for JavaScript in Visual Studio Code
You've got some javascript you want to refactor so you open Visual Studio Code and get cracking. But since you've decided to write it in plain javascript it's an untyped mess. You look at that property you just renamed, are you sure you found
JavaScript
Extending Javascript prototypes
Browsers have varying support for different features in javascript, some support more functions, others support less. I'm not going to be so crass as to name names here but if we wanted to use Array.prototype.find we'd have problems on a certain browser from Redmond[
jQuery
Introducing jQuery.dirty
Having previously blogged about checking if a form has been modified I needed something slightly different I came across dirrty, a jQuery plugin by Ruben Torres that I personally found to have a cleaner implementation than the dirtyFields I previously wrote about. For instance, to check if a form has
DateTime
Going on a date with javascript
First things first, the Date object in javascript is misnamed, it represents a date and a time. It should be DateTime instead but that's nowhere near the biggest issue. </pedantry> When dealing with dates there are a number of things to remember. Months are zero indexed,
JavaScript
Javascript and weakly defined types (Part 2: Electric Boogaloo)
Javascript and its lack of strong typing continues to cause headaches. Today's one is caused by the following bit of madness if (true) { alert("true evaluates as true"); // will show } if (false) { alert("false evaluates as true"); // will not show } if ('true'
Internet Explorer
Internet Explorer and button events
Filing this one under "Strange decisions that Internet Explorer makes", IE will assume that when a user hits enter in a textbox, they want to submit the form they are filling out. Normally this would be a reasonable assumption except for two problems; * IE does not check that
JavaScript
Javascript, isNaN and parsing
A word of warning with javascript and the magic of the isNaN function If we have an element such as <input type="hidden" id="myelement" value="(some optional value)" /> Then if myelement has a value of "1" <input type=
C#
Parsing numbers in C based languages
In some C based languages such as C++, Java or Javascript any leading zeros at the start of a number will cause that number to be treated as octal (base 8). This peculiar issue can occur in templating or anything else where a text input will be treated as a
JavaScript
Javascript and weakly defined types
Javascript is a weakly typed language, a variable can be equal to another if they have the same value even if they are different types. As a result, Javascript has two equality operators; == checks if the values of the compared objects are equal === checks if the values and types of
Browser Link
window.onbeforeunload not running
After recently upgrading to Visual Studio 2013 I noticed that a page which uses the window.onbeforeunload event wasn't calling the method I wrote. Checking the chrome console I was seeing this instead of the function I had written. The culprit is Browser Link, a technology introduced in
JavaScript
Checking on client side if form has been modified
I'm editing a record in a web application and I accidentally click on something I shouldn't have. The page navigates away and when I hit back I see that all my changes have been lost. This still happens with an almost disturbing level of regularity, I