03: Simple Math and Strings

In this code sample you will learn what a string is and also how to do some simple math, as well as use a little bit of the Math library. As usual, you are to type this code in, get it working, and watch the video for additional information on these concepts. You should also attempt to break this code and change it in some way that you find interesting.

The Code

{{ ork.js() }}

In JavaScript there are a few ways to create a string. You can create a string with a single–quote 'Like this', with a double-quote "Like this", and in another way that you will learn about later in the course. Math and JavaScript use the same rules as your algebra class, where you used the acronym PEMDAS to figure out the order of operations. Remember that PEMDAS is more like PE(MD)(AS), meaning you do the parentheses, followed by exponents, followed by multiplication and division in order, followed by addition and subtraction in order. In some countries they use a different acronym for this, but it should be similar as math tends to be very universal.

Learn JavaScript Today

Register today for the Beginner Basics course and get the new releases by just paying the difference. There's also special discounts for existing customers when new courses are released.

Still Not Sure? Check out more curriculum!