Return to Snippet

Revision: 24221
at February 23, 2010 17:52 by alvincrespo


Initial Code
<script type="text/javascript">
	//replace a string
	var astring = "Peter picked a peck of pickled peppers, how many peppers did Peter Piper pick?";
	console.log(astring.replace(/peppers/gi,"parsnips"));
	
	//truncate a string
	console.log(astring.substr(0,30));
	
	//display numbers 0 -> 100 skipping 2
	for(var i = 0; i<=100; i+=2){
		if(i == 0)
			console.log(0);
		else
			console.log(i-1)
	}
</script>

Initial URL

                                

Initial Description
These are essential javascript techniques every javascriptr must know. I will be adding more to this list, let me know what you'd like to see. Thanks!

Initial Title
Essential Javascript Techniques

Initial Tags
javascript, replace

Initial Language
JavaScript