Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Backward Each Word by mortonfox
// jshint esversion: 6, node: true
"use strict";
function backwardStringByWord(a) {
return a.replace(/[a-z]+/ig, t => t.split('').reverse().join(''));
}
// var assert = require('assert');
// if (!global.is_checking) {
// console.log('Example:');
// console.log(backwardStringByWord(''));
// // These "asserts" are used for self-checking
// assert.equal(backwardStringByWord(''), '');
// assert.equal(backwardStringByWord('world'), 'dlrow');
// assert.equal(backwardStringByWord('hello world'), 'olleh dlrow');
// assert.equal(backwardStringByWord('hello world'), 'olleh dlrow');
// assert.equal(backwardStringByWord('welcome to a game'), 'emoclew ot a emag');
// console.log("Coding complete? Click 'Check' to earn cool rewards!");
// }
April 23, 2020
Comments: