I m creating an HTML5 with Javascript, but sometimes the code is executing the next line of statement before the current line is finished,
For example, I m passing an image to an object in Javascript, but then the next statement is executed already before the object has the image, so sometimes the object has no image, but sometimes it has,
So between the 2 lines I need to assign something like callback or wait function, but i dont know how
var image=new Image();
ws.send("complete");