1 of 10 simple JavaScript exercises.
http://www.ling.gu.se/~lager/kurser/webtechnology/lab4.html
JavaScript Exercise:
4. Write a function translate() that will translate a text into "rövarspråket". That is, double every consonant and place an occurrence of "o" in between. For example, translate("this is fun") should return the string "tothohisos isos fofunon".
<h1>Hello Ludovic Ceccotti </h1>
<hr />
<h3>JavaScript Exercise:</h3>
<p>
Write a function translate() that will translate a text into "rövarspråket". That is, double every consonant and place an occurrence of "o" in between. For example, translate("this is fun") should return the string "tothohisos isos fofunon".
</p>
<hr />
<h3>Console Log Out:</h3>
<div id="console-log"></div>
<hr />
JavaScript
//Hack to mimic console within JSFiddle
var consoleLine = "<p class=\"console-line\"></p>";
console = {
log: function (text) {
$("#console-log").append($(consoleLine).html(text));
}
};
// List of consonants that should be doubled:
// ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', // 'v', 'w', 'x', 'y', 'z'];
console.log('Original string is: this is fun')
console.log('The separator is: "o"')
console.log('The "rövarspråket" result should be: "tothohisos isos fofunon"')
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.