R
R
Ruslan Mingazov2018-01-27 13:20:11
JavaScript
Ruslan Mingazov, 2018-01-27 13:20:11

I don't understand specifically what `+e.target.innerText` does?

I don't understand specifically what `+e.target.innerText` does

onYearBtnClick(e) {
    this.props.setYear(+e.target.innerText)
  }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Polos, 2018-01-27
@greedrussell

They wrote in the comment that this is a unary plus, so that the text inside the node from the string is converted to a number.
https://learn.javascript.ru/operators

A
Andrey Tsvetkov, 2018-01-27
@yellow79

e.target - the element that was clicked
innerText - the text content of the element

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question