A really nice online tool on which you can try things instantaly is the fiddle.
Now if you want to try java script you can use http://www.jsfiddle.net
If you want to try .NET code you can use https://dotnetfiddle.net
I personally ike JsBin.
I will update this post with more tips and tricks.