Changed comparing undefined to null to just checking if num doesn't exis...

Changed comparing undefined to null to just checking if num doesn't exist. This is a slightly more elegant solution and less reliant on a JavaScript quirk that treats undefined and null both as false. Thanks Len!