Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wisePerson(wiseType,whatToSay) {
- return `A wise ${wiseType} once said: "${whatToSay}".`;
- }
- const wisePerson2 = (wiseType, whatToSay) => `a ${wiseType} b: ${whatToSay}`;
- function testWisePerson() {
- const wiseType = 'goat';
- const whatToSay = 'A bird in the hand is worth 2 in the bush.';
- const expected = 'A wise ' + wiseType + ' once said: "' + whatToSay + '".';
- const actual = wisePerson(wiseType, whatToSay);
- if (expected === actual) {console.log('Test Successful')}
- else {console.log("Test Failed" + '\n expected:' + expected + '\n actual:' + actual );}
- }
- console.log(wisePerson('goat', 'Hello world'));
- console.log(wisePerson2('goat', 'Hello world'));
- testWisePerson();
- function shouter(whatToShout) {
- return whatToShout.toUpperCase();
- }
- function testShouter() {
- const whatToShout = 'hello Jim!!!';
- const expected = "HELLO JIM!!!";
- const actual = shouter(whatToShout);
- if (expected === actual) {
- console.log('Shouter Test Working');
- }
- else {
- console.log('Shouter Test Failed');
- }
- }
- testShouter()
- console.log(shouter('hello Jim!!!'));
- const textNormalizer = (text) => text.toLowerCase();
- console.log(textNormalizer('HELLO Jim, THIS is sUper dUper!'));
- const testTextNormalizer = () => {
- const text = 'HELLO Jim, THIS is sUper dUper!';
- const expected = 'hello jim, this is super duper!';
- const actual = textNormalizer(text);
- console.log( (expected === actual) ? 'TextNormalizer is working' : 'TextNormalizer is failing');
- return 0;
- }
- testTextNormalizer();
Add Comment
Please, Sign In to add comment