Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //تشابتر4 ملف السويتش
  2. var grade = "PREMIUM";
  3.  
  4.  
  5. switch (grade){
  6.  
  7. case "REGULAR":
  8.     alert ("it is $3.15");
  9.  
  10. break;
  11.  
  12. case "PREMIUM":
  13.     alert ("it is $3.35");
  14.  
  15. break;
  16.  
  17. case "DIESEL":
  18.     alert ("it is $3.47");
  19.  
  20. break;
  21.  
  22.   default:
  23.  alert("THAT IS NOT VALID GRADE")
  24.  
  25.  
  26.  
  27.  
  28.  
  29. }
  30. ==================================================================
  31. ///تشابتر 5 اول ملف
  32. function myfunction(){
  33.  
  34. var a = 5;
  35.  
  36. var b = 10;
  37.  
  38. var c = 20;
  39.  
  40. var d = a + b + c;
  41.  
  42.  
  43. alert("The value of d is: " + d );
  44.  
  45.  
  46.  
  47.  
  48. }
  49. myfunction();
  50. myfunction();
  51. myfunction();
  52. myfunction();
  53. myfunction();
  54.  
  55. ==================================================================
  56.  
  57. ///تشابتر 5 ثاني ملف
  58. function addTwoNumbers(a,b){
  59.  
  60.    
  61.         var result = a + b;
  62.  
  63.     return result;
  64. }
  65. var x = addTwoNumbers(5,10);
  66. alert(x);
  67.      
  68.  
  69. addTwoNumbers(500,100);
  70.  
  71.      addTwoNumbers(7,-2323);
  72. ==================================================================
  73.  
  74. ///تشابتر 6
  75. var amount =0;
  76. // create the index
  77.  
  78. var i=0;
  79. // chick condition
  80.  
  81. while (i<=10){
  82. amount = amount +100;
  83.  
  84.  
  85. //incremant index
  86.  
  87.  
  88. i++;
  89.  
  90. }
  91.  
  92. alert("the value is:" + amount);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement