i have around 6 var "256-512-1M.. and so on" which store in my database as value like "1-2-3 .. and so on" i want the code if the value "1" turn or appear 256 if value "2" // // // 512 if value "3" // // // 1M i try to solve more time but i failed plz help me Thx in advence
If I understand correctly, you need something like this: var new_value = value*256; if(new_value >= 1024) new_value = new_value/1024+'M'; Code (markup):
i think this what i want var data = 2; var speed = ["256", "512", "1024", "2048", "4096"]; var arrayi = data - 1; document.write(speed[arrayi]); Code (markup):