One of the biggest things I've found is, let's say you have a function that returns coordinates (or any object really), similar to this.
function getCoordinates() {
return
{
x: 10,
y: 10
};
}
You would expect to get back an object right? WRONG! You get back undefined. The interpreter converts the code into this
function getCoordinates() {
return;
{
x: 10,
y: 10
};
}
Since return
by itself is a valid statement. You need to be sure to write the return as follows
function getCoordinates() {
return {
x: 10,
y: 10
};
}