daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 celsToFahr(celsTemp){
  12.   return celsTemp * (9 / 5) + 32;
  13. }
  14.  
  15. function fahrToCels(fahrTemp){
  16.   return 5 * (fahrTemp - 32) / 9;
  17.  
  18. }
  19.  
  20. function test(){
  21.   var cels = 100;
  22.   var fahr = 32;
  23.   var celconv = 212;
  24.   var fahrconv = 0;
  25.  
  26.   if(celconv === celsToFahr(cels)){
  27.     console.log('CelsToFahr working');
  28.   }else{
  29.     console.log('CelsToFahr not working');
  30.   }
  31.  
  32.   if(fahrconv === fahrToCels(fahr)){
  33.     console.log('FahrToCels working');
  34.   }else{
  35.     console.log('FahrToCels not working');
  36.   }
  37. }
  38.  
  39.   test();
  40. </script>
  41.  
  42.  
  43.  
  44. <script id="jsbin-source-javascript" type="text/javascript">function celsToFahr(celsTemp){
  45.   return celsTemp * (9 / 5) + 32;
  46. }
  47.  
  48. function fahrToCels(fahrTemp){
  49.   return 5 * (fahrTemp - 32) / 9;
  50.  
  51. }
  52.  
  53. function test(){
  54.   var cels = 100;
  55.   var fahr = 32;
  56.   var celconv = 212;
  57.   var fahrconv = 0;
  58.  
  59.   if(celconv === celsToFahr(cels)){
  60.     console.log('CelsToFahr working');
  61.   }else{
  62.     console.log('CelsToFahr not working');
  63.   }
  64.  
  65.   if(fahrconv === fahrToCels(fahr)){
  66.     console.log('FahrToCels working');
  67.   }else{
  68.     console.log('FahrToCels not working');
  69.   }
  70. }
  71.  
  72.   test();</script></body>
  73. </html>
RAW Paste Data
Top