-1

so theres an code like this

const a = "point1,point2"

console.log(a)

the result will be "point1,point2" in the console

the question How do we get that result changed to "point1 / point2" in console

2 Answers2

1

There are 100 ways to achieve that:

//1 one way    
const a = "point1,point2"
console.log(a.split(',').join('/'))//will output point1/point2

//Another way    
console.log(a.replace(',','/'))//will output point1/point2

//...For the rest learn the basic of javascript and find answers alone

Stop running...take your time to learn basic before tackling little projects

Christian LSANGOLA
  • 2,947
  • 4
  • 22
  • 36
0

You can use String.prototype.replace method to replace , by /

const a = "point1,point2"

console.log(a.replace(',', '/'));

Lear more on String.prototype.replace here

Yves Kipondo
  • 5,289
  • 1
  • 18
  • 31