JS
What’s new in JavaScript
ES2023
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
/ 13
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
ES2023
1
Gaute Meek Olsen
2
Stages
0
1
2
3
4
3
findLast
const
array
=
[
1
,
2
,
3
,
4
,
5
]
const
even
=
array
.
find
((
n
) =>
n
%
2
===
0
)
console
.
log
(
even
)
4
findLastIndex
function
findLastIndex
(
array
,
predicate
) {
let
l
=
array
.
length
;
while
(
l
--
) {
if
(
predicate
(
array
[
l
]
,
l
,
array
))
return
l
;
}
return
-
1
;
}
const
array
=
[
1
,
2
,
3
,
4
,
5
]
console
.
log
(
findLastIndex
(
array
,
(
n
) =>
n
%
2
===
0
))
5
toReversed
const
array
=
[
3
,
2
,
1
]
const
reversed
=
array
.
reverse
()
console
.
log
(
array
)
console
.
log
(
reversed
)
6
toSorted
const
array
=
[
3
,
2
,
1
]
const
sorted
=
array
.
sort
((
a
,
b
) =>
a
-
b
)
console
.
log
(
sorted
)
7
toSpliced
const
array
=
[
'🍎'
,
'🥝'
,
'🍊'
]
const
myFruit
=
array
.
splice
(
0
,
1
,
'🥦'
)
console
.
log
(
array
)
console
.
log
(
myFruit
)
8
with
const
array
=
[
'a'
,
'b'
,
'd'
]
9
Symboler i WeakMap, WeakSet og WeakRef
const
symbol
=
Symbol
(
'my-symbol'
)
const
symbol2
=
Symbol
(
'my-symbol'
)
console
.
log
(
symbol
===
symbol2
)
const
cache
=
new
WeakMap
()
const
key
=
{}
cache
.
set
(
key
,
'hello'
)
console
.
log
(
cache
.
get
(
key
))
10
Hashbang
#!/usr/bin/env node
console
.
log
(
'👋'
)
11
12
Takk for meg!
13