मैं इस कोड को बदलने के लिए चाहते हैं:तीर समारोह "अभिव्यक्ति की उम्मीद" सिंटेक्स त्रुटि
var formatQuoteAmount = function (tx) {
return Currency.toSmallestSubunit(tx.usd, 'USD');
};
var quoteAmounts = res.transactions.map(formatQuoteAmount);
एक गुमनाम तीर समारोह में
। मैं इस लिखा है:
var quoteAmounts = res.transactions.map(tx => Currency.toSmallestSubunit(tx.usd, 'USD'));
मैं तीर पर expression expected
सिंटेक्स त्रुटि मिलता है। मैंने the default syntax here देखा और ऐसा लगता है कि मेरे कोड का सिंटैक्स सही है। कोई विचार क्या समस्या हो सकती है?
मैं इसे इस वाक्य रचना के साथ काम किया है:
var quoteAmounts = res.transactions.map(function (tx) {
return Currency.toSmallestSubunit(tx.usd, 'USD')
});
लेकिन मैं इसे एक एक लाइनर बनाने के लिए, तो तीर के समारोह के साथ चाहते हैं।
पर node v5.3.0
यह 'console.log (res.transactions) का होल्डिंग/आउटपुट क्या है;' – Jai
आप इसे किस वातावरण में चला रहे हैं? – nils
@nils, 'node.js' में। मैंने ओपी टैग अपडेट किया। – Milkncookiez