Search Header Logo
JavaScript Introduction

JavaScript Introduction

Assessment

Presentation

Computers

Vocational training

Practice Problem

Medium

Created by

Sudo Aldrich

Used 12+ times

FREE Resource

25 Slides • 13 Questions

1

JavaScript

media

2

  • Programming language for the web

  • An interpreted programming language

  • Used for creating interactive web pages

  • Could be used as a server-side programming language using Nodejs, Deno, or Bun

What is JavaScipt?

media

3

  • Created in just 10 days by Brendan Eich for Netscape Navigator

  • Originally named Mocha

  • There's no actual relation to Java

  • One of the most popular languages

  • Runs everywhere

  • Supports multiple programming paradigms (Object-Oriented, Functional, and Procedural)

  • Asynchronous by Nature

Cool facts about JavaScript

media

4

Multiple Choice

JavaScript is not

1

Compiled

2

Asynchronous

3

Object-Oriented Programming

4

Client-Side programming language

5

Multiple Choice

JavaScript is related to Java

1

Yes

2

No

6

Where is the output?

media

​JavaScript output could be shown in...
1. HTML. Using DOM API
2. Dialog. Using `alert`
3. Console. Using `console` API.

7

DOM/HTML Output

media
media

8

alert / Browser Dialogs

media
media

9

Console Outputs

media
media

10

Running JavaScript using <script> tag

media
media

​<script> tag could be used anywhere in the html file

11

Running external JavaScript using <script> tag

media
media
media

12

In JavaScript statements are separated by semicolons (;)

JavaScript Syntax

media
media

13

JavaScript Comments

media
media

14

JavaScript Blocks

media

​JavaScript could grouped together by using code blocks.
In JavaScript, we're using curly braces to indicate code blocks.

15

JavaScript Blocks

media
media

16

  • The var keyword was used in all JavaScript code from 1995 to 2015.

  • The let and const keywords were added to JavaScript in 2015.

  • The var keyword should only be used in code written for older browsers.

JavaScript Variables

media

17

JavaScript Variables

media
media

18

Fill in the Blanks

19

Multiple Choice

What is the correct way to create a multi-line comment

1
2

20

Multiple Choice

Question image

What is the output of the code?

1

ReferenceError: color is not defined

2

yellow

3

undefined

4

"yellow"

21

Multiple Choice

Question image

What is the value of color?

1

blue

2

green

3

SyntaxError: Identifier 'color' has already been declared

22

JavaScript Arithmetic

media
media

23

JavaScript Assignment

media
media

24

JavaScript Data Types

media
  • Boolean (true or false)

  • Number (64-bit floating point)

  • BigInt (A new data type introduced in ES2020)

  • String (Any text)

  • Undefined (A variable/type that is undefined)

  • Null (Represents absence of value)

  • Object (A variable that may contain properties)

  • Symbol (Guaranteed unique value)

25

JavaScript Data Types are Dynamic

media
media
media

26

Multiple Choice

Question image

What is the value of color?

1

Null

2

Symbol(color)

3

False

4

Undefined

27

Multiple Choice

Question image

What is the value of "total"?

1

10

2

1010

3

Error

4

"1010"

28

Multiple Choice

Question image

What is the value of "total"?

1

"0"

2

0

3

Error

29

Multiple Choice

Question image

`!!` is used to convert any truthy or falsy value to boolean.

In this case, what is the value of "a"?

1

True

2

False

30

Multiple Select

Question image

Select correct ways to get a property from an object

1

a.name

2

a['name']

3

a.get('name')

4

a.getName()

5

const { name } = a

31

JavaScript Function

media
media

32

DOM API

media
  • ​DOM stands for Document Object Model

  • A platform and a language neutral interface to access and modify content, structure, and style of a document

33

DOM API: Selecting an Element

media
media

34

DOM API: Changing Elements

media
media

35

DOM API: addEventListener()

media

​`addEventListener()` would allow us to attach functions to a DOM elements events.

Common events are:
- click
- mouseover
- submit

Full List at https://www.w3schools.com/jsref/dom_obj_event.asp

36

DOM Manipulation

media
media

37

Multiple Choice

Question image

To select button using DOM API we must use...

1

document.getElementById("button1")

2

document.getById("button1")

3

document.getElementById("#button1")

4

document.getElement("#button1")

38

Multiple Select

Question image

Choose all the correct ways to select the button

1

document.getElementsByClassName("btn btn-primary")

2

document.querySelector("button[class='btn btn-primary']")

3

document.getElementById("btn btn-primary")

4

document.querySelector(".btn.btn-primary")

JavaScript

media

Show answer

Auto Play

Slide 1 / 38

SLIDE