Coding Bootcamp Week 7
More Javascript!
Progressing through the course, we are moving through more JavaScript concepts.
Numbers, Strings and Operators (the below is from MDN)
Integers are whole numbers, e.g. 10, 400, or -5.
Floating point numbers (floats) have decimal points and decimal places, for example 12.5, and 56.7786543.
Doubles are a specific type of floating point number that have greater precision than standard floating point numbers (meaning that they are accurate to a greater number of decimal places).
Arithmetic operators (+,-,*,/ etc)
To start with, enter the following lines:
let string = 'The revolution will not be televised.';
string;
Concatenating strings
- Concatenate is a fancy programming word that means “join together”. Joining together strings in JavaScript uses the plus (+) operator, the same one we use to add numbers together, but in this context it does something different. Let’s try an example in our console.
let one = 'Hello, '; let two = 'how are you?'; let joined = one + two; joined;
Finding the length of a string
This is easy — you simply use the length property. Try entering the following lines:
let browserType = 'mozilla';
browserType.length;
Definitely starting to sink in to my head just need to practice!