โค้ดโปรแกรม
// reverse string
const reverse = (s)=>{
let rvs = ""
for(let i=s.length-1;i>=0;i--){
rvs = rvs+s.charAt(i)
}
return rvs
}
// check
const tx = "appcodemia camp"
console.log(tx)
console.log(reverse(tx))
โค้ดโปรแกรม
// reverse string
const reverse = (s)=>{
let rvs = ""
for(let i=s.length-1;i>=0;i--){
rvs = rvs+s.charAt(i)
}
return rvs
}
// check
const tx = "appcodemia camp"
console.log(tx)
console.log(reverse(tx))