简体   繁体   中英

Refactor ECMAScript 6 destructuring assignment (ES2015) to old version javascript

I want to refactor a code from ECMAScript 6 to classic javascript. I have this code of destructuring assignment.

var {innerHTML: value} = e.target;

Please give the equivalent of it

Thank you.

You will probably want to do something like this:

var value = e.target.innerHTML;

The destructuring isn't doing anything too clever, it is just assigning the value of the innerHTML property on e.target to a new variable value .

Edit: Just saw @Emissary's comment. Snap!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM