0% found this document useful (0 votes)
2 views

JavaScript Data Types

The document is a presentation on JavaScript data types, including both primitive and non-primitive types. It includes interactive elements like identifying impostors among code snippets and definitions, as well as learning objectives for students. The presentation aims to enhance understanding of JavaScript's syntax and the importance of different data types in programming.

Uploaded by

Marieanne Faith
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

JavaScript Data Types

The document is a presentation on JavaScript data types, including both primitive and non-primitive types. It includes interactive elements like identifying impostors among code snippets and definitions, as well as learning objectives for students. The presentation aims to enhance understanding of JavaScript's syntax and the importance of different data types in programming.

Uploaded by

Marieanne Faith
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 54

LET’S LEVEL

UP THE
KNOWLEDG
E!
Presentation by
Ma’am Ali
attendanc
e check!
Prayer
Find the
impostor!
Guess which among the crewmates
given is the impostor for each level.
Analyze and use your previous
knowledge to catch different the
impostors!
There is an impostor among

APPLE us!
ORANGE

GRAPES LETTUC
impostor
E
There is an impostor among

let x = 100; us! let x = -100;


impostor
x >>= 5; x <<= 5;

let x = -100; let x = -100;


x >>>= 5; x >>= 5;
There are 2 impostor among

-= us! /=

&=
impostor **=

|=
impostor
There is an impostor among

let x = 10; us!


x **= 5;
impostor
let x = 5; y =
10;
let z = x % y;

let x = 10; let x = 10;


x += 5; x /= 5;
There are 2 impostor among

Reminder us! impostor


Modulus

Bitwise Logical
OR AND
impostor
Decrement
There is an impostor among

let x = 10; us! let x = 10;


x %= 5; x &&= 5;

let x = 10;
impostor
let text =
"Hello"; text += "
x |= 5;
World";
You
did
well!
Learner’s data

Try to identify the following definitions.


Analyze the pictures given as clues for the
word you will find.
Example:
These are used to perform
different types of mathematical
and logical computations.

Operations
It is a series of characters that are
surrounded by quotes in
JavaScript.

Strings
A data type in JavaScript that has
only two values which are true and
false.

Booleans
A data type in JavaScript includes
both integers and floating-point
numbers.

Number
These are key-value pairs used to
store data, created with {} or the
new keyword.

Object
A variable that has been declared
but not initialized with a value
which means the variable exists,
but it has no value assigned to it.

Undefined
It is a built-in object that provides
a way to represent whole numbers
greater than 2 .53

bigint
GREAT JOB!
Code Breaker

Decode the following expressions to unlock


the topic for today. Each answer have their
equivalent letters as clue to decode the
word you need to complete.
Q W
Code
E R
Breaker
T Y U I O P
6 12 18 24 30 36 42 48 54 60
A S D F G H J K L
11 22 33 44 55 66 77 88 99
Z X C V B N M
13 26 39 52 65 78 91
1. (7 + 4) * 3 = _____ D 5. 5 * 5 + 5 = _____ T
2. 5 * 10 – 39 = _____ A 6. 100 - 64 = _____ Y
3. 10 + 15 + 5 = _____ T 7. (10 * 5) + 50 – 40 = P
4. 10 * 10 - 89 = _____ A _____
8. 4 * 4 + 2 = _____ E
S
DATA TYPE 9. 100 ÷ 4 - 3 = _____
Good
thinking!
JavaScript
DATA
types
Learning Objectives:
At the end of the lesson, the students will
be able to:
a. discuss the different data types in
JavaScript;
b. create a syntax using the different data
types including the operators, and
c. appreciate the importance of using different
data types and functions in their website.
JavaScript Data Types

Primitive data types Non-Primitive data types

Number Boolean Object Function

String BigInt Arrays Date Object

Null Symbol Regular expression

Undefined
Primitive data types
All types except Object define
immutable values represented directly
at the lowest level of the language. In
JavaScript, a primitive (value, data type)
is data that is not an object and has no
methods or properties.
An immutable value is one whose
content cannot be changed without
creating an entirely new value.
Syntax
Number
The Number
data type in
JavaScript
includes both
• integers and
Integers: Whole numbers
floating-point
without a decimal point, such as
1, 42,numbers.
or -7.
• Floating-point numbers: Result
Numbers with a decimal point,
such as 3.14, -0.001, or 2.71828.
BigInts are represented by appending
an "n" to the integer literal: The "n"
BigInt suffix is a type identifier that tells
JavaScript to interpret the number as a
BigInt is a built-in In JavaScript,
BigInt, all numbers
enabling are
it stored
to in
handle a 64-bit floating-
arbitrarily
point format (IEEE 754 standard).
large integers.With this standard, large
object that provides
integer cannot be exactly represented and will be
a way to represent rounded.
whole numbers
greater than 253. The Because of this, JavaScript can only safely represent
largest number that integers:
JavaScript can Up to 9007199254740991 +( 2 53
-1); and
reliably represent Down to -9007199254740991 -( 2 53
-1).
with the Number
Integer values outside this range lose precision.
primitive is 2 .
53
String
A String in
JavaScript is a
series of
characters that
• are surrounded
Template literals are literals
by quotes.
delimited with backtick (`)
characters, allowing for multi-line
strings, string interpolation with
embedded expressions, and
special constructs called tagged
templates.
Syntax
Syntax

Boolean
The
Boolean
data type
represents
a logical
entity and
is
inhabited
by two
values:
Syntax
Comparisons and Conditions
Comparison operators are used in logical
statements to determine equality or difference
between variables or values.

JavaScript also contains a conditional operator


that assigns a value to a variable based on
some condition.
given that
x=5
Example syntax of Comparison
operators
Syntax
Null
The special null
value does not
belong to any
of the default
data types. It
forms a
separate type
of its own
which contains
only the null
value.
Syntax
Undefined
A variable that
has been
declared but
not initialized
with a value is
automatically
assigned the
undefined
value. It means
the variable
exists, but it
has no value
What’s the difference?
Non-Primitive data types

The data types that are derived from


primitive data types are known as non-
primitive data types. It is also known as
derived data types or reference data
types.
They can store collections of values or
more complex entities.
Syntax
Symbol
Symbols are
unique and
immutable
primitive
values used as
identifiers for
object
properties.
They help
create unique
keys in objects,
preventing
Arrays Syntax
An Array is a
special kind of
object used to
store an
ordered
collection of
• values, which
JavaScript arrays are
can
writtenbe
withof any
square
brackets.
data type.
• Array items are
separated by commas.
Object Syntax
An object in
JavaScript is a
data structure
used to store
related data
collections. It
stores data as
key-value pairs,
where each key
is a unique
identifier for the
associated
value. Objects
Syntax
Typeof
The typeof operator
returns the type of a
variable or an
• expression.
typeof null returns “object”, which is
misleading and a legacy bug in
JavaScript.
• Cannot distinguish between arrays and
objects (typeof {} is “object”).
• typeof NaN returns “number”, though
it’s technically “not a number.”
Functions Syntax
• AAJavaScript
function inis
function
JavaScript
defined with the is a
function
block
keyword, of by a
followed
name, followedcode
reusable by
parentheses ().
designed
• The parentheses may
to
perform a
include parameter names
specific
separated task
by commas:
when called.
(parameter1, parameter2,
...)
• The code to be executed,
by the function, is placed
inside curly brackets: {}
important
The primitive data types include:
key points
String - Used for text, represented within quotes (e.g., "Hello" or 'World’).
Number - Represents both integers and floating-point numbers (e.g., 42, 3.14).
BigInt - Handles integers larger than the Number type can accommodate.
Boolean - Represents logical values (true or false).
Undefined - A variable that has been declared but not assigned a value.
Null - Represents the intentional absence of any object value.
Symbol - A unique and immutable data type often used as object property identifiers.

JavaScript includes non-primitive data types, such as objects, which can store
collections of data or more complex entities like arrays, functions, and custom objects.
The typeof operator is essential for checking a variable's data type, which helps
identify values during debugging or coding
Output 3.3
“personal portfolio”
Instructions:
Write a syntax that stores portfolio details
in variables. Output all information in a
formatted way with the help of different
data types.
Ensure to prepare outputs for the coding
and result
(Variable declaration and Portfolio details)
Variables to be used:
• STRINGS – full name (LS, FN, MI), nickname
• NUMBER – age, output number
• BOOLEAN – Is a student
• UNDEFINED – project title
• NULL – project score
• SYMBOL – LRN id
• OBJECT – crush {name, age}, pet {name, breed, color,
gender}

You might also like