//Main function
function main() {
var input1 = readLine();
var input2 = readLine();
var arr1 = input1.split(" ");
var arr2 = input2.split(" ");
var arrJoined = arr1.concat(arr2);
print("array joined: "+ arrJoined);
var arrSliced = arr1.slice(1,arr1.length-1);
print("array sliced: " + arrSliced);
var arrSplice = arr2.slice(0);
arrSplice.splice(2,1);
print("array spliced: " + arrSplice);
var arrAlpha = arr1.slice(0);
arrAlpha.sort();
print("array alphabatized: " + arrAlpha);
var arrAlphaRev = arr1.slice(0);
arrAlphaRev.sort().reverse();
print("array alphabatized reverse: " + arrAlphaRev);
}
//encoding function
function encode(inputArg) {
var output = "";
for(var i = 0; i < inputArg.length; i++){
//we want the value of i to become two plus the value of j
alphaMatch = alpha.indexOf(inputArg[i]);
alphaMatch += 2;
output += alpha[alphaMatch];
} print(output);
return output;
}
//decoding function
function decode(outputArg) {
var decodeOutput = "";
for(var i = 0; i < outputArg.length; i++){
//we want the value of i to become two plus the value of j
alphaMatch2 = alpha.indexOf(outputArg[i]);
alphaMatch2 -= 2;
decodeOutput += alpha[alphaMatch2];
} print(decodeOutput);
}
function practice31() {
var input = readLine();
if (input.startsWith("a") || input.startsWith("e") || input.startsWith("i") || input.startsWith("o") || input.startsWith("u")) {
print("true");
} else {
print("false");
}
}
function practice30() {
var input1 = readNumber();
var input2 = readNumber();
var output = 1;
for (input1; input1 < input2; input1++) {
output = output + input1;
}
print(output);
while (input1 < input2) {
output += input1;
input1++;
}
print(output);
}
function practice29B() {
var input = readLine();
if (input.length > 5) {
if (input.length % 2 == 0) {
print(input.substring(0, input.length / 2));
...
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.