JavaScript membalikkan string
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Grepper
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
const str = 'JavaScript is awesome';
function reverseAString(str) {
return str.split('').reverse().join('');
}
console.log(`Reversed string is: ${reverseAString(str)}`);
function reverseString(str) {
return str.split("").reverse().join("");
}
reverseString("hello");
let a = "foo";
// function for reversing a string
function reverseString(str) {
return str.split("").reverse().join("");
}
console.log(a); // "foo"
let b = reverseString(a);
console.log(b); // "oof"
const reverse = (str) => str.split("").reverse().join("");
var s = userInput[0];
var rev = [];
for(let i=0;i<s.length;i++)
{
rev.push(s[s.length-1-i]);
}
console.log(rev.join(""));