Tutorial:JavaScript
From Metrixstream
(Difference between revisions)
MetrixAdmin (Talk | contribs) (Created page with "= Logging = Logging is your friend. It isn't always supported, so you need to write your own wrapper around it. All logging will go to the console window which is located in the...") |
MetrixAdmin (Talk | contribs) |
||
Line 4: | Line 4: | ||
<script> | <script> | ||
− | + | ||
function log(str) { | function log(str) { | ||
if (window["console"] && window["console"]["log"]) window["console"]["log"](str); | if (window["console"] && window["console"]["log"]) window["console"]["log"](str); | ||
} | } | ||
− | + | ||
</script> | </script> |
Revision as of 13:29, 6 June 2012
Logging
Logging is your friend. It isn't always supported, so you need to write your own wrapper around it. All logging will go to the console window which is located in the developer tools for most popular web browsers.
<script> function log(str) { if (window["console"] && window["console"]["log"]) window["console"]["log"](str); } </script>