So first I went threw the material we were given at the college as study material. Since I skipped the first class since I am currently away I thought I will do more and learn more then less.
Went threw the first lessons and I learned this:
Types and Operators
This what I have learned so far.
console.log(33.7); // Numbers - Any number, including numbers with decimals: 4, 1516, .002, 23.42. In the example above, 40.7 is a number.
console.log(true); // Booleans Either true or false, with no quotations. In the example above, true is a boolean.
console.log(null); // Null Can only be null. It represents the absence of value.
- Data is printed, or logged, to the console with command
Gets you an output:
- Four built-in mathematical operators include
Using these you can perform various mathematical operations:
console.log(32 + 3.5);
console.log(2017 - 1969);
console.log(65 / 240);
console.log(0.2708 * 100)
Using those properties you can find out the length of the text you get:
console.log('Teaching the world how to code'.length)
// Log Codecademy in all uppercase letters
// Use a string method to log the following statment without whitespace at the beginning and end of it.
console.log(' Remove whitespace '.trim());
- Libraries are collections of methods that can be called without an instance.
One collection contains mathematical methods, aptly named the
Math library which have these examples below.
And also there are way more then mentioned previously. For example Built In Number library.
console.log(Math.floor(Math.random() * 100 )); //random number rounded to decimal
- You can write single-line comments with
// and multi-line comments between
There are only two types of comments. But you can use them to perform all the tasks.
console.log('It was love at first sight.');
/*console.log('The first time Yossarian saw the chaplain he fell madly in love with him.');
console.log('Yossarian was in the hospital with a pain in his liver that fell just short of being jaundice.');
/*console.log('The doctors were puzzled by the fact that it wasn\'t quite jaundice.');
console.log('If it became jaundice they could treat it.');
console.log('If it didn\'t become jaundice and went away they could discharge him.');
console.log('But this just being short of jaundice all the time confused them.');*/
It was love at first sight.
That is it for the part 1.
Go to the part 2 >>