Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 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>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. function computeArea(width, height) {
  12. return width * height;
  13. }
  14.  
  15. computeArea(2, 2);
  16.  
  17. /* From here down, you are not expected to
  18. understand.... for now :)
  19.  
  20.  
  21. Nothing to see here!
  22.  
  23. */
  24.  
  25.  
  26.  
  27. // tests
  28.  
  29. function testComputeArea() {
  30. var width = 3;
  31. var height = 4;
  32. var expected = 12;
  33. if (computeArea(width, height) === expected) {
  34. console.log('SUCCESS: `computeArea` is working');
  35. }
  36. else {
  37. console.log('FAILURE: `computeArea` is not working');
  38. }
  39. }
  40.  
  41. testComputeArea();
  42. </script>
  43.  
  44.  
  45.  
  46. <script id="jsbin-source-javascript" type="text/javascript">function computeArea(width, height) {
  47. return width * height;
  48. }
  49.  
  50. computeArea(2, 2);
  51.  
  52. /* From here down, you are not expected to
  53. understand.... for now :)
  54.  
  55.  
  56. Nothing to see here!
  57.  
  58. */
  59.  
  60.  
  61.  
  62. // tests
  63.  
  64. function testComputeArea() {
  65. var width = 3;
  66. var height = 4;
  67. var expected = 12;
  68. if (computeArea(width, height) === expected) {
  69. console.log('SUCCESS: `computeArea` is working');
  70. }
  71. else {
  72. console.log('FAILURE: `computeArea` is not working');
  73. }
  74. }
  75.  
  76. testComputeArea();</script></body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement