JSFiddle

  • Truncate a string

    https://www.freecodecamp.com/challenges/truncate-a-string

    function truncateString() {
      var str = document.getElementById('inputString').value;
      var num = document.getElementById('lengthToTruncate').value;
      var result = document.getElementById('result');
    
      if ...
  • Repeat string

    Mootools 1.4.5, HTML, CSS, JavaScript

    function repeatStringNumTimes() {
      var input = document.getElementById('inputStr').value;
      var num = document.getElementById('number').value;
      var result = document.getElementById('result');
      var ...
  • Largest numbers in given nested array

    Mootools 1.4.5, HTML, CSS, JavaScript

    function largestOfFour() {
      var arr = [
        [4, 5, 1, 3],
        [13, 27, 18, 26],
        [32, 35, 37, 39],
        [1000, 1001, 857, 1 ...
  • Title case a sentence

    Mootools 1.4.5, HTML, CSS, JavaScript

    function titleCaseMe() {
      var input = document.getElementById('inputSentence').value;
      var tokenArray = input.split(' ');
    
      var tokenize = tokenArray.map(function(val) {
        var token ...
  • Longest word in string

    Mootools 1.4.5, HTML, CSS, JavaScript

    function findLongestWord() {
      var str = document.getElementById('inputString').value;
      var tokenArray = str.split(' ');
      var longestLength = 0;
      var token = tokenArray.map(function ...
  • Check for palindrome

    FreeCodeCamp - Basic algorithm scripting

    function checkpalindrome() {
      var input = document.getElementById('input').value;
      var re = /\W+/;
      var underscore = /_/;
    
      while (re.test(input)) {
        input = input ...
  • Find factorial

    Mootools 1.4.5, HTML, CSS, JavaScript

    function factorial() {
      var input = document.getElementById('inputText').value;
      var factorialResult = document.getElementById('factorialResult');
      var factorial = 1;
      for (var i = input ...