简体   繁体   中英

JavaScript Concat issue with Currency Symbol

I have to concat a numeric value with currency code, but the currency get append after the numeric value like د.إ111 but I want the currency to be appended in the front and then the price value

let price = 111;
let currency = "د.إ";
let str3 =  currency.concat(price)
console.log(str3)

You can do it with the RTL code, the price will be on the RH and following by the currency name on the LH:

 let price = 111; let currency = "دإ"; let RTL = ""; console.log(RTL +price + " " + currency); // another method let str3 = `${RTL}${price} ${currency}`; console.log(str3);

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