javascript exercism.io bob solution
JavaScript
var Bob = function() {
return {
hey: function(input) {
// Remove leading or trailing spaces just in case.
input = input.trim();
// Check for silence (empty string or spaces which would be removed by trim above).
if (input === '') {
return 'Fine. Be that way!';
}
// Regular expression to test if there are any letter (alphabetic) characters
// in input string. (Regex excludes non-alpha characters.)
regex = /[^\W\d_]+/g;
// Test for alpha characters and SHOUTING.
if (regex.test(input) && input === input.toUpperCase()) {
return 'Whoa, chill out!';
}
// Check for a question.
if (input.charAt(input.length-1) === '?') {
return 'Sure.';
}
// All other cases:
return 'Whatever.';
}
};
};
module.exports = Bob;
Also in JavaScript:
- Title
- how to access clipboard via js
- Category
- JavaScript
- Title
- how to take an element out of an array in javascript
- Category
- JavaScript
- Title
- javascript ascii to hex
- Category
- JavaScript
- Title
- install vue js
- Category
- JavaScript
- Title
- ionic (Emitted value instead of an instance of Error
- Category
- JavaScript
- Title
- javascript Clone an array
- Category
- JavaScript
- Title
- html get class property
- Category
- JavaScript
- Title
- chart.js data from mysql vanila javscript
- Category
- JavaScript
- Title
- ${ js
- Category
- JavaScript
- Title
- get element by class
- Category
- JavaScript
- Title
- check if string is datestring javascript
- Category
- JavaScript
- Title
- for(let [key,val] in obj){ messageBody = messageBody.replace("{"+ key + "}",val) }
- Category
- JavaScript
- Title
- how to update kali linux on virtualbox
- Category
- JavaScript
- Title
- access to static file nodejs
- Category
- JavaScript
- Title
- dropdown list value react fragment
- Category
- JavaScript
- Title
- how to return the number of nodes in a linked list
- Category
- JavaScript
- Title
- default props react
- Category
- JavaScript
- Title
- How to check if a member has a role discord.js
- Category
- JavaScript
- Title
- if condition in class angular 8
- Category
- JavaScript
- Title
- iterate through nested object javascript
- Category
- JavaScript
- Title
- how to get the index of an array in javascript
- Category
- JavaScript
- Title
- how to add validator to formgroup
- Category
- JavaScript
- Title
- excel javascript api protect worksheet
- Category
- JavaScript
- Title
- copy one array to another javascript
- Category
- JavaScript
- Title
- discord.js multiple embeds
- Category
- JavaScript
- Title
- covid
- Category
- JavaScript
- Title
- javascript array concat spread operator
- Category
- JavaScript
- Title
- dockerfile for nodejs
- Category
- JavaScript
- Title
- get current screen name react navigation
- Category
- JavaScript
- Title
- add firebase angular
- Category
- JavaScript
- Title
- bq show pretty json
- Category
- JavaScript
- Title
- Getting the differences between two objects javascript lib
- Category
- JavaScript
- Title
- javascript anagram check
- Category
- JavaScript
- Title
- how to use a fixed time zone in nodejs
- Category
- JavaScript
- Title
- how to find the index of a value in an array in javascript
- Category
- JavaScript
- Title
- javaScript Age in Dog years //write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years function dog Years() javaScript
- Category
- JavaScript
- Title
- example of validating fields on your own in express
- Category
- JavaScript
- Title
- how to pass props in react test cases
- Category
- JavaScript
- Title
- hashing in javascript
- Category
- JavaScript
- Title
- express route parameters
- Category
- JavaScript
- Title
- close bootstrap modal with javascript
- Category
- JavaScript
- Title
- alert user javascript
- Category
- JavaScript
- Title
- input not detecting text
- Category
- JavaScript
- Title
- import dropdown react
- Category
- JavaScript
- Title
- fetch api react
- Category
- JavaScript
- Title
- ajax with progress bar
- Category
- JavaScript
- Title
- http request javascript
- Category
- JavaScript
- Title
- create a customer in stripe node.js
- Category
- JavaScript
- Title
- Add object to array javascript
- Category
- JavaScript
- Title
- dumpdata json model dajngo
- Category
- JavaScript
- Title
- get width of a dom element js
- Category
- JavaScript
- Title
- How to uninstall npm modules in node js?
- Category
- JavaScript
- Title
- how to import npm packages in node.js?
- Category
- JavaScript
- Title
- angular transition animation
- Category
- JavaScript
- Title
- compare dates in javascript
- Category
- JavaScript
- Title
- compare dates in js
- Category
- JavaScript
- Title
- Function used to reload the portion of a page using javascript
- Category
- JavaScript
- Title
- get current time epoch javascript
- Category
- JavaScript
- Title
- how to find unique elements in array in javascript
- Category
- JavaScript
- Title
- how to get a user input in js
- Category
- JavaScript
- Title
- get full url nodejs
- Category
- JavaScript
- Title
- change the value in checkbox by button react
- Category
- JavaScript
- Title
- javascript ajax post send an object
- Category
- JavaScript
- Title
- add a slash to string in javascript
- Category
- JavaScript
- Title
- javascript ajax request
- Category
- JavaScript
- Title
- edje js not pre compile for node 12 version
- Category
- JavaScript
- Title
- async await react stackoverflow
- Category
- JavaScript
- Title
- javascript arrow function
- Category
- JavaScript
- Title
- format date js
- Category
- JavaScript
- Title
- Can't bind to 'formGroup' since it isn't a known property of 'form'
- Category
- JavaScript
- Title
- how to remove first character from string in javascript
- Category
- JavaScript
- Title
- angular two way property binding
- Category
- JavaScript
- Title
- express validator always return error
- Category
- JavaScript
- Title
- angular bootstrap not working
- Category
- JavaScript
- Title
- changing attributes using javascript
- Category
- JavaScript
- Title
- how to count click events javascript
- Category
- JavaScript
- Title
- how to set three js canvas width 100%
- Category
- JavaScript
- Title
- how to append in javascript
- Category
- JavaScript
- Title
- angular npm angular material
- Category
- JavaScript
- Title
- delete last element of array js
- Category
- JavaScript
- Title
- how to access a database in express
- Category
- JavaScript
- Title
- how to map over arrays vuejs
- Category
- JavaScript
- Title
- how to check chrome version in js
- Category
- JavaScript
- Title
- D3.js
- Category
- JavaScript
- Title
- can't modify range value js
- Category
- JavaScript
- Title
- graphql react filtering
- Category
- JavaScript
- Title
- if statement in javascript
- Category
- JavaScript
- Title
- add a route to a buttoin in angular
- Category
- JavaScript
- Title
- for of and for in javascript
- Category
- JavaScript
- Title
- How do I check whether a checkbox is checked in jQuery?
- Category
- JavaScript
- Title
- how to link javascript to html
- Category
- JavaScript
- Title
- how do you remove a remove element from array in javascript
- Category
- JavaScript
- Title
- How to check whether a string contains a substring in JavaScript?
- Category
- JavaScript
- Title
- how to check if something is array javascript
- Category
- JavaScript
- Title
- javacript count properties
- Category
- JavaScript
- Title
- HTML5 Accesskey Attribute: you may not need JavaScript to add Keyboard Shortcuts
- Category
- JavaScript
- Title
- angular two datepickers
- Category
- JavaScript
- Title
- how to delete a variable in js
- Category
- JavaScript
- Title
- how to use custom stylesheets express node
- Category
- JavaScript
- Title
- function to create an element javascript
- Category
- JavaScript