A Pen by Dan

Thumbnail
This awesome code was written by -dan, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright -dan ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Dan</title>
  
  
  
  
  
</head>

<body>

  
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/-dan/a-pen-by-dan-bYOxwY */
var incrementChar = function incrementChar(str) {
  var trimmed = str.trim();
  var number = parseInt(trimmed);
  var nextNumber = number + 1;
  return String.fromCharCode(nextNumber);
};

var Box = function Box(x) {
  return {
    map: function map(f) {
      return Box(f(x));
    }
  };
};

var ic = function ic(str) {
  return [str].map(function (s) {
    return s.trim();
  }).map(function (s) {
    return parseInt(s);
  }).map(function (s) {
    return s + 1;
  }).map(function (s) {
    return String.fromCharCode(s);
  });
};

console.log(incrementChar(' 64 '));
console.log(ic(' 64 '));

Comments