On Github danielconnor / jsseek-presentation
Daniel Connor - C00137906
IT Carlow - 22/03/2013
A javascript error generator that takes a function as input and creates test cases to show any errors that can be found
Variables can contain any type of value.
var a; a = 1; // number a = ""; // string a = {}; // object a = []; // array a = /^regular expression$/g; // regular expression
var a = {}; a.property = "a string"; function example(a) { // checking if a will have a certain property if(a.property != null) { // do something... } }
TypeErrors are the most common type of error.
function example(callback) { //do something callback(); }
function greeter(person: string) { return "Hello, " + person; } var user = "Jane User"; document.body.innerHTML = greeter(user);
Values can be coerced to perform operations on different types.
"1" + 2 + 3 = "123" "3" - 1 = 2 null == undefined
Execution of a program using symbolic values rather than real ones.
function example(obj) { if(obj != null) { if(obj.prop == null) { obj.prop = {}; } obj.prop.value = 10; } }