Month of February 2016
-
"Hello, World!" in Pascal
A "Hello, World!" program in Pascal can be written by calling the global WriteLn function to send the "Hello, World!" string to the standard output stream.
-
"Hello, World!" in ZX Spectrum machine code
A "Hello, World!" program in Z80 assembler for the ZX Spectrum can be written by calling the CHAN_OPEN and PRINT subroutines to send the "Hello, World!" string to the screen channel.
-
"Hello, World!" in CSS
A "Hello, World!" program in CSS can be written by setting the "Hello, World!" text as the content of the ::before pseudo-element of the html element.
-
"Hello, World!" in HTML
A "Hello, World!" program in HTML can be written by creating a paragraph element containing the "Hello, World!" text.
-
"Hello, World!" in JavaScript
A "Hello, World!" program in JavaScript can be written by calling the log method of the console object to send the "Hello, World!" string to the standard output stream, or the developer console in a web browser.
-
"Hello, World!" in PHP
A "Hello, World!" program in PHP can be written by using the built-in echo statement to send the "Hello, World!" string to the standard output stream.
-
Overriding console.log in JavaScript
JavaScript is a dynamic language, where even functions are just object variables, pointing to some runnable code. This makes it possible to replace default implementations with your own implementations. However, if you are not careful, it can lead to problems that are hard to debug.
-
"Hello, World!" in Java
A "Hello, World!" program in Java can be written with a static main method of a class, and calling the println method of the System.out PrintStream object to send the "Hello, World!" string to the standard output stream.
-
"Hello, World!" in C#
A "Hello, World!" program in C# can be written with a static Main method of a class, and calling the WriteLine method of the static System.Console class to send the "Hello, World!" string to the standard output stream.
-
"Hello, World!" in C++
A "Hello, World!" program in C++ can be written with a main function and using the insertion operator << to send the "Hello, World!" string to the std::cout stream buffer.
-
"Hello, World!" in C
A "Hello, World!" program in C can be written by calling the puts function to send the "Hello, World!" string to the standard output stream.
-
JavaScript countdown using localStorage
Using localStorage, it's possible to implement a countdown clock in JavaScript that survives a reboot of the user's computer. However, it's not possible to know when the user clears their localStorage contents.
-
Formatting a truncated float in JavaScript
By combining multiplication, division, and Math.floor(), it is possible to truncate a floating point number to a chosen number of decimals in JavaScript. Here, I explain every step of the way, and show how it's done in a one-liner.