Kursinnhold
Introduction to JavaScript
Introduction to JavaScript
1. Getting Started
First Javascript Console ApplicationChallenge: Showing some OutputChallenge: Outputing Multiple LinesDealing with NumbersChallenge: Working with NumbersChallenge: Calculating the Speed of a CarChallenge: Calculating Area of a TrapeziumOutputting Multiple ValuesChallenge: Consoling Meaningful OutputHow to Use Comments in Javascript?Challenge: Adding a CommentMulti-Line CommentsChallenge: Commenting out CodeWhat Is JavaScript anyway?
2. Manipulating Data
Storing DataChallenge: Declaring a VariableChallenge: Accessing Data From a VariableChallenge: Fixing Variable NamesChallenge: Reassigning a VariableConstantsChallenge: Declaring & Using ConstantsPerforming Arithmetic On VariablesChallenge: Making a Salary CalculatorChallenge: Adjusting Salary with a BonusExploring Primitive Data TypesChallenge: Declaring a Boolean ValueHow different Data Types InteractChallenge: Concatenating StringsChallenge: Creating User Profile & Activity Details
3. Conditional Statements
Comparison OperatorsChallenge: Checking Age EligibilityThe `if` StatementChallenge: Weather-Based Outfit RecommenderChallenge: Even or OddNested Conditional StatementsThe `else` ClauseChallenge: Improving Even or Odd CheckerChallenge: Temperature AdvisorThe `else if` ClauseChallenge: Grade Categorizer` AND` Logical OperatorChallenge: Checking if a Number is Even and PositiveOR Logical OperatorChallenge: Accessing Control System
4. Mastering Functions
What Are Functions?Challenge: Simple FunctionChallenge: Calculating the Speed of a CarScopesPassing Data into FunctionsChallenge: Fixing the Speed FunctionChallenge: Improving the Grade CategorizerTask: Defining a Compound FunctionReturning Data from FunctionsDefault ValuesChallenge: Email Auto-Responder with Default Parameters
5. Exploring Arrays
What Are Arrays?Challenge: Defining An ArrayChallenge: IndexingAdding Values to an ArrayChallenge: Pushing Elements to an ArrayRemoving Elements from an ArrayChallenge: Practicing `pop` & `shift`The `length` PropertyChallenge: Counting ElementsThe `includes` MethodChallenge: Searching for Animals in the Zoo
Dealing with Numbers
Summary
Textual data is always enclosed in single or double quotation marks.
For example:'Hello World'
or"Hello World"
— both represent valid textual data;There are two different types of numbers in JavaScript:
Integers;
Floating-point numbers;
Floating-point numbers (also known as Floats) are numerical values that have a decimal part.
Examples:1.234
,24.56
,3.1415
, etc;Negative numbers can be expressed by adding a minus (
-
) sign before the number. Examples:-27
,-3.14
,-123
, etc;Arithmetic operations can be performed on numbers using the following operators:
+
,-
,*
,/
, and**
;The order of arithmetic operations follows the basic rule of arithmetic (BODMAS or PEMDAS rules).
// Integer console.log('Integer:', 42); // Floating-Point Number console.log('Floating-Point:', 3.14); // Negative Number console.log('Negative:', -27); // Arithmetic Operations console.log('Sum:', 42 + 3.14); console.log('Product:', 42 * -27);
1. Which of the following is the correct way to represent textual data?
2. Which of the following is NOT a valid number type?
3. Which of the following represents a Floating-Point Number?
4. Which of the following represents a negative number?
5. How would you multiply two numbers?
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 4