Sha256: 346b43266b8baac78f3e44b5400faeac09eb0772bc72e00ae2d6c27a94d4da09

Contents?: true

Size: 507 Bytes

Versions: 211

Compression:

Stored size: 507 Bytes

Contents

let isSilence = (message) => message.replace(/\s+/g, '') === '';
let isShouting = (message) => message.toUpperCase() === message && /[A-Z]/.test(message);
let isAQuestion = (message) => message[message.length - 1] === '?';

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

export default Bob;

Version data entries

211 entries across 211 versions & 1 rubygems

Version Path
trackler-2.2.0.0 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.55 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.54 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.53 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.52 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.51 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.50 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.49 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.48 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.47 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.46 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.45 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.44 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.43 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.42 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.41 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.40 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.39 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.38 tracks/ecmascript/exercises/bob/example.js
trackler-2.1.0.37 tracks/ecmascript/exercises/bob/example.js