Guest User

Untitled

a guest
Dec 15th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Text Normalizer</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. function textNormalizer(text) {
  12.  
  13. return text.toLowerCase().trim();
  14. }
  15.  
  16.  
  17.  
  18. function testTextNormalizer() {
  19. var text = " let's GO SURFING NOW everyone is learning how ";
  20. var expected = "let's go surfing now everyone is learning how";
  21. if (textNormalizer(text) === expected) {
  22. console.log('SUCCESS: `textNormalizer` is working');
  23. }
  24. else {
  25. console.log('FAILURE: `textNormalizer` is not working');
  26. }
  27. }
  28.  
  29. testTextNormalizer();
  30. </script>
  31.  
  32.  
  33.  
  34. <script id="jsbin-source-javascript" type="text/javascript">function textNormalizer(text) {
  35.  
  36. return text.toLowerCase().trim();
  37. }
  38.  
  39.  
  40.  
  41. function testTextNormalizer() {
  42. var text = " let's GO SURFING NOW everyone is learning how ";
  43. var expected = "let's go surfing now everyone is learning how";
  44. if (textNormalizer(text) === expected) {
  45. console.log('SUCCESS: `textNormalizer` is working');
  46. }
  47. else {
  48. console.log('FAILURE: `textNormalizer` is not working');
  49. }
  50. }
  51.  
  52. testTextNormalizer();</script></body>
  53. </html>
Add Comment
Please, Sign In to add comment