Dynamically Modifying Input Elements on Click

Sometimes it’s necessary to modify an input form element when a user clicks on that element. In some cases, the form element can contain information regarding what information is appropriate, or what format is expected. The most common example is showing “mm/dd/yyyy” in a text-based date field and automatically removing that information when a user clicks on the field.

Continue reading

Javascript Benchmarking with JSBenchtest

Javascript benchmarking couldn’t be easier. With this webpage you can input any Javascript code and test how fast it is. The webpage will automatically call your code for 1,000,000 iterations and report the total amount of time that it took to execute. It will even output a variable that you can use for debugging. You can now test an algorithm, make a modification, and test again to see if the modification helped the execution time.

Click here to benchmark some code.

Continue reading

Switch vs If – Which is faster?

In programming there are two different methods that people use to test variables that have a number of different values. One method is to use the If statement and define blocks of code to perform. The other common method is to use a switch statement and list all possible values, perhaps including a default value, and perform some process inside the appropriate section of code.

Continue reading