in php, if you wanna check the status of a variable, it's var_dump($variablename);
You can use on mobile browsers:
console.log(object);Chrome even let you edit the object on via its console 😀
y prefer, for php, print_r
$name = print_r(obj, true);So y can do things like:
"I like to print this string, just cuz my name is {$name}"Really idiomatic code and easy to understand (that is why I always use {}, even if $name would work fine in that case.
I don't think print_r tells you if the $variable is a string, array or integer or the like though. If you just want the content though, yes it is better.
P.S you could just print_r(obj, true); I think. Not tested though, so I could be wrong. Probably depends what obj/true actually is/are. If it is print_r($variable); though, yes, that would be the simplest way to do it unless you want to reuse $name in your example.
If you want to know more about the array of arrays method search for jagged arrays on google.
Javascript doesn't support multithreading, right ? 🙁
I can now make my JS count numbers and tell if its odd or even... Also did a "class" and a child of that class
Well ruby has the methods even? and odd? in integer, but usually you can check it by doing:
number & 1 == 0 // number is evennumber % 2 == 0 // number is evenYou can also change the zero check by doing !! like:
!!(number & 1)!!(number % 2)Javascript's speed really is just a matter of what it does,
think than javascript does not have integers, while this seems trivial, integer operations are arround 1.5 times faster than floating point operations.
Of course it depends on the VM, V8 is awesome, SpiderMonkey is great, but you know how awful is in IE8 (wich some people STILL have, arround 10% of the traffic in the pages I manage are visited with IE8)
jQuery is only really needed when you are working with DOM (in other words, HTML) or AJAX calls (wich are easy to implement normally too) you may want to add jQuery or prototype, but I don't see the use of that in your game.
There is a pc version, after all.
JSON is one of the cool aspects of javascript, the only 'problem' is that it doesn't support function declarations.
probably we will have our database in JSON (or having some black magic to read it with blobs ad file apis in html)
Not really, this is not valid JSON:
{ 'my_callback' : function (x, y) { return x * y; } }It is done for security reasons, you may know how dangerous are callbacks like this...
It is HTML5 (the web version) there are PC and MAC versions wich may or may not use HTML5 (they may use something like V8 inside a C++ APP)