Sha256: c57266d5de2815241484ea3017eddb15821b574228730c332563841a3525b20b

Contents?: true

Size: 619 Bytes

Versions: 208

Compression:

Stored size: 619 Bytes

Contents

function Bob() {
  'use strict';

  function isSilence(message) {
    return message.replace(/\s+/g, '') === '';
  }

  function isShouting(message) {
    return message.toUpperCase() === message && /[A-Z]/.test(message);
  }

  function isAQuestion(message) {
    return message[message.length - 1] === '?';
  }

  this.hey = function(message) {
    if (isSilence(message)) {
      return 'Fine. Be that way!';
    } else if (isShouting(message)) {
      return 'Whoa, chill out!';
    } else if (isAQuestion(message)) {
      return 'Sure.';
    } else {
      return 'Whatever.';
    }
  };
}

module.exports = Bob;

Version data entries

208 entries across 208 versions & 1 rubygems

Version Path
trackler-2.1.0.12 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.11 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.10 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.9 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.8 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.7 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.6 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.5 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.4 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.3 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.2 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.1 tracks/javascript/exercises/bob/example.js
trackler-2.1.0.0 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.55 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.54 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.53 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.52 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.51 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.50 tracks/javascript/exercises/bob/example.js
trackler-2.0.8.49 tracks/javascript/exercises/bob/example.js