testeoutravez

JavaScript performance comparison

Test case created by Hugo Carvalho

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
I
function reverseOdd(str) {
  return str.split(" ").map(w => w.length%2 ? [...w].reverse().join("") : w).join(" ");
}
reverseOdd("Make sure uoy only esrever sdrow of ddo length")
pending…
II
function reverseOdd(str) {
	return (
		str.split(" ")
			 .map(word => {
			 word = word.split("");
			 if (word.length % 2 !== 0) word = word.reverse();
			 word = word.join("");
			 return word;
			})
			.join(" ")
	)
}
reverseOdd("Make sure uoy only esrever sdrow of ddo length")
pending…
III
function reverseOdd(str) {
	let arr = []
  str.split(" ").forEach(item=> {
    if(item.length % 2 !== 0){
       arr.push(item.split("").reverse().join(""))
    } else arr.push(item)
  })
  return arr.join(" ")
}
reverseOdd("Make sure uoy only esrever sdrow of ddo length")
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments