ECMA 2025

From bibbleWiki
Jump to navigation Jump to search

Introduction

Not much to say here - hi

Promise.try

Allow you to return a promise from a function

Promise.try(func)

New Set Functions

Loving the diagram for Mr dyslexic.

RegExp

This has been changed but I never understand it. Thanks to robots don't need too. But the RegEx.escape look nice.

Import

The with keyword is now supported e.g.

import styles from "./styes.css" with { type:" "css"}
import data from "./data.json" with { type:" "json"}

Iterator

Been update to support map, take, filter. I really like these but never seen people use them, only libraries. But here is an example.

function* naturals() {
    let i = 0
    while(true) {
        yield i;
        i += 1
    }
}

const result = naturals()
    .map(value => {
        return value * value
    })

result.next() // value: 0, done:  false)
result.next() // value: 1, done:  false)
result.next() // value: 4, done:  false)

Float16Array

Does what is says on the tin.