- The console is a panel which displays important messages for developers.
- Calling the
.log()method on the
consoleobject will print or log to the console the data within parenthesis.
Hello!, is being printed to the console.
- A comment is a useful note within a program.
- It is ignored by the program and exists solely for informational purposes to those reading your code.
Use two forward slashes
// for a single line comment.
/* at the start and `/` at the end of a multi-line comment*.
//Hey! I'm ignored by the program.
/*Me too!This is all commented.*/
- Any grouping of characters surrounded by single
'New York City'
- Any number including decimals
- true or false values
- The absence of a valuenull
Remainder (modulo): %
- Returns the remainder of dividing the right-hand number by the left-hand number.
console.log(5 + 7);console.log(6 - 2);console.log(3 * 5);console.log(10 / 5);console.log(22 % 7);
12 4 15 2 5
- String concatenation is the process of appending one string to another.
- Using the
+operator on two strings, we can append the string on the right to the string on the left.
console.log('New ' + 'York');
- A property is stored information about an instance of a data type.
- To utilize a property, append an instance with a period followed by the property name.
length property on the instance of a string returns the number of characters in that string.
- Methods are actions that can be performed on an instance of a data type.
- To utilize a method, append an instance with a period, (the
.operator), the method name, and opening and closing parentheses.
.toUpperCase()method on the string instance returns the string in all capital letters.
.ceil() method on the built-in
Math object returns the next whole number rounded up.
Learn More on Codecademy
Code FoundationsStart your programming journey with an introduction to the world of code and basic concepts.
Includes 5 Courses