JS
What’s new in JavaScript
ES2022
Gaute Meek Olsen
Enter fullscreen
Go to previous slide
Go to next slide
Show slide overview
Switch to dark mode theme
Show drawing toolbar
Show info
Adjust settings
1
/ 14
Draw with stylus
Draw a line
Draw an arrow
Draw an ellipse
Draw a rectangle
Erase
Adjust stroke width
Set brush color
Set brush color
Set brush color
Set brush color
Set brush color
Set brush color
Set brush color
Undo
Redo
Delete
Pin drawing
JS
What’s new in JavaScript
ES2022
1
Gaute Meek Olsen
2
JavaScript
ECMAScript
ES
TC39
ES6
ES2015
3
Ecma international
TC39
ECMAScript
JavaScript
ES6
===
ES2015
4
ES2022 (ES13)
5
Top-level await
(
async
() => {
const
response
=
await
fetch
(
'https://catfact.ninja/fact'
)
;
const
data
=
await
response
.
json
()
;
console
.
log
(
data
.
fact
)
;
})()
;
6
.at()
const
list
=
[
'🐯'
,
'🐥'
,
'🦞'
]
;
const
last
=
list
[
list
.
length
-
1
]
;
console
.
log
(
last
)
;
7
Error cause
function
save
(
data
) {
try
{
writeToFile
(
data
)
;
}
catch
(
error
) {
throw
new
Error
(
'Could not write to file'
)
;
}
}
try
{
save
(
'something'
)
;
}
catch
(
error
) {
console
.
error
(
error
)
;
}
8
Object.hasOwn
const
human
=
{
age
:
5
}
console
.
log
(
human
.
hasOwnProperty
(
'age'
))
;
9
RegExp match indices
const
match
=
/\d+/
.
exec
(
'find the number 123 please'
)
;
const
start
=
match
.
index
;
console
.
log
(
start
)
;
10
class - public field
class
Robot
{
constructor
() {
this
.
name
=
'Optimus Prime'
;
}
;
}
const
robot
=
new
Robot
()
;
console
.
log
(
robot
.
name
)
;
11
class - private
class
Robot
{
}
12
class - static
class
Robot
{
}
13
Takk for meg!
14