Blog

JavaScript – Degree & Radian Conversion

Two very simple operations that you may have to deal with if writing a JavaScript that deals with trigonometry are Math.degrees() and Math.radians(). These function can be easily defined as follows: // Converts from degrees to radians. Math.radians = function(degrees) { return degrees * Math.PI / 180; }; // Converts Read more…

By Chris West, ago
Blog

Here Document

Something that you may not know about PHP and many other languages is that it provides heredoc syntax to build strings. What does this mean? Check out the following: $title = 'Test HTML Page'; $myCode = <<<STR <html> <head> <title>$title</title> </head> <body> <h1>$title</h1> <p>This is a test page to show Read more…

By Chris West, ago
Blog

Regular Expression Examples

One of the things that I love about string manipulation is the existence of regular expressions. For this reason, I have decided to share a few examples that may help those who are learning about regular expressions so that can understand them a bit better. JavaScript – General Variable Name Read more…

By Chris West, ago