the console keyworkd refers to an object, a collection of data and actions, that we can use in our code.
Keywords are words that are built into the JS language, so the computer will recognize them and treats them specially.
It's going to be easy for us to print values to the console, so we can see the work that we're doing.
As we write JavaScript, we can write comments in our code that the computer will ignore as our program runs. These comments exist for human readers.
There are two types of code comments in JavaScript.
1.ex) // prints 5 to the console
console.log(5);
/*This is all commented
console.log(10);*/
console.log(/*IGNORED!*/5);//still just prints 5
Data types are the classifications we give to the different kinds of data that we use in programming.
Basic arithmetic often comes in handy when programming.
An operator is a charater that performs a task in our code.
when a +operator is used on two strings, it appends the right string to the left string: This is called concatenation
console.log('hi'+'ya');//prints 'hiya'
When you introduce a new piece of data into a JavaScript program, the browser saves it as an instance of the data type. Every string instance has a property called length that stores the number of characters in that string.
console.log('Hello'.length);//5
Remember that methods are actions we can perform
ex)'example String'.methodName()
console.log('hello'.toUpperCase());//HELLO
In addition to console, there are other objects built into JavaScript.
For example, if you want to perform more complex mathematical operations tha arithmetic, JS has the built-in Math object.
ex) console.log(Math.random()); This method returns a random number between 0 and 1. To generate a random number between 0 and 50,we could multiply this result by 50-> Math.random()50;
Math.floor() takes a decimal number and round down to the nearest whole number.
console.log(Math.floor(math.random()50));//prints a random whole number between 0 and 50
참고:codecademy
Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks ดูหนังออนไลน์
Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post. world's best back scratcher
Level up your data analysis skills with the Power BI training Malaysia from TED Learning. Visit our website to enroll in the program and get certification.
I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. MEGA888