We need to save server bandwith to send and receive json files so instead of this long responses:
(...)
{
var serverResponse = JSON.parse(xml.responseText);
switch(serverResponse.votestatus)
{
case 'image_deleted':
console.log("image deleted");
break;
case 'image_not_found':
console.log("image not found");
break;
}
}
(...)
We shorten the strings like this (2 strings are double the size of one):
{
var serverResponse = JSON.parse(xml.responseText);
switch(serverResponse.votestatus)
{
//image deleted
case '1':
console.log("image deleted");
break;
//image not found
case '2':
console.log("image not found");
break;
}
}
The question is are Strings bigger in size than integers? is this
var a = "1";
bigger in size than this?
var a = 1;