martinxii
martinxii

Reputation: 1

why is react returning parsing error: unexpected token

Failed to compile I'm trying to run a currency converter app but i keep getting this when i try to fetch the response from an API

./src/Components/currencyconvert.js

  Line 25:22:  Parsing error: Unexpected token

  23 |              const currencyAr =  ["EUR"]
  24 |              for (const key in response.data.rates){
> 25 |                  currencyAr.push.(key);
     |                                  ^
  26 |               }
  27 |          this.setstate({currency: currencyAr });
  28 |          })      

Upvotes: 0

Views: 30

Answers (1)

mleister
mleister

Reputation: 2545

Simple remove the dot.

currencyAr.push.(key);

should be

currencyAr.push(key);

Upvotes: 1

Related Questions