简体   繁体   中英

How to replace strings in a variable with Javascript

I have the following question and I was wondering how this could be done?

Use JavaScript function to replace 'Analytics' with 'Data science' string in the following variable:

var info = "Analytics helps optimizing e-commerce";

Little confusing -- but if it's hard coded in your code just change it there...

if not - try info.replace('Analytics', 'Data science') wherever you return that variable

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