What's new

Web Printing an object property in array syntax

  • Thread starter DatBoiJay53
  • Start date
  • Views 252
DatBoiJay53

DatBoiJay53

Enthusiast
Messages
634
Reaction score
120
Points
135
PHP:
<script type="text/javascript">
			var player = new Object();
			player.hasWhatWeapon = "M4";
			player["has this weapon"] = "AK47";
			with (player)
			{
				screen(hasWhatWeapon); // 1
				screen(["has this weapon"]); // 2
			}
		</script>

For some reason, '1' prints perfectly fine, but '2' prints as a string. Why? Out of about the 10 times i tried this, '2' printed its actual value once. o_O is there an easier way to make sure it doesnt do this?
 
Top Bottom
Login
Register