B
B
Breeze12019-11-08 01:53:56
JavaScript
Breeze1, 2019-11-08 01:53:56

How to rewrite code for IE 11?

Tell me how to properly remake this code for IE 11. It swears at invalid characters and breaks all js.

let vh = window.innerHeight * 0.01;
    document.documentElement.style.setProperty('--vh', `${vh}px`);

    window.addEventListener('resize', () => {
        let vh = window.innerHeight * 0.01;
        document.documentElement.style.setProperty('--vh', `${vh}px`);
    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Chipekwe, 2019-11-08
@Breeze1

vh + 'px'
and the arrow function needs to be changed to a regular one

S
SagePtr, 2019-11-08
@SagePtr

As far as I remember, IE does not support ES6 at all (this applies to both arrow functions and const / let and template strings. It's easier to run the code through babel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question