Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 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. // // const score = 40;
  12.  
  13. // // if(score >= 50){
  14. // // console.log('pass')
  15. // // } else {
  16. // // console.log('fail')
  17. // // }
  18.  
  19.  
  20. // // ternary operator
  21.  
  22. // // let result = score >= 50 ? 'pass' : 'fail'
  23.  
  24. // // console.log(result)
  25.  
  26. // // function calculateGrade(score) {
  27. // // return score >= 50 ? 'pass' : 'fail'
  28. // // }
  29.  
  30. // // const calculateGrade = function(score) {
  31. // // return score >= 50 ? 'pass' : 'fail'
  32. // // }
  33.  
  34. // // const result = calculateGrade(score)
  35. // // console.log(result)
  36.  
  37. // // arrow fucntion
  38. // // const calculateGrade = (score) => score >= 50 ? 'pass' : 'fail'
  39.  
  40. // // const calculateArea = (width, height) => width * height
  41.  
  42. // // const result = calculateArea(5,4);
  43. // // const result = calculateGrade(score)
  44. // // console.log(result)
  45. // // const calculateArea = (width)=> (height) => width * height
  46.  
  47. // // const result = calculateArea(5)(4);
  48. // // console.log(result)
  49.  
  50. // //javascript object
  51. // const person ={
  52. // id:1,
  53. // name:'P',
  54. // age:23
  55. // }
  56. // //add
  57. // // person.isRich = true
  58.  
  59. // // console.log(person)
  60. // // console.log(person['name'])
  61.  
  62.  
  63. // // newperson same person
  64. // // const newPerson = person
  65. // // console.log (newPerson.name)
  66.  
  67.  
  68. // //Destructuring
  69. // // const {name,age} = person
  70. // // console.log (name)
  71. // // console.log (age)
  72.  
  73. // // const {name: newPerson,age} = person
  74. // // console.log (newPerson)
  75. // // console.log (age)
  76.  
  77. // //spread & rest operator ...
  78.  
  79. // person.isRich = true;
  80.  
  81. // const newPerson = {...person,isRich: true}
  82. // // const {name,isRich,...other} = newPerson
  83. // // console.log (name)
  84. // // console.log (isRich)
  85. // // console.log (other)
  86.  
  87. // //add result in array
  88. // const nums = [1,2,3,4]
  89.  
  90. // const numsWithFive = [...nums, 5]
  91.  
  92. // console.log(numsWithFive)
  93.  
  94. //Class
  95. class Person {
  96. constructor(id, name, age) {
  97. this.id = id;
  98. this.name = name;
  99. this.age = age;
  100. }
  101. }
  102.  
  103. const person = new Person(1, "mark", 34)
  104. console.log(person)
  105. </script>
  106.  
  107.  
  108.  
  109. <script id="jsbin-source-javascript" type="text/javascript">// // const score = 40;
  110.  
  111. // // if(score >= 50){
  112. // // console.log('pass')
  113. // // } else {
  114. // // console.log('fail')
  115. // // }
  116.  
  117.  
  118. // // ternary operator
  119.  
  120. // // let result = score >= 50 ? 'pass' : 'fail'
  121.  
  122. // // console.log(result)
  123.  
  124. // // function calculateGrade(score) {
  125. // // return score >= 50 ? 'pass' : 'fail'
  126. // // }
  127.  
  128. // // const calculateGrade = function(score) {
  129. // // return score >= 50 ? 'pass' : 'fail'
  130. // // }
  131.  
  132. // // const result = calculateGrade(score)
  133. // // console.log(result)
  134.  
  135. // // arrow fucntion
  136. // // const calculateGrade = (score) => score >= 50 ? 'pass' : 'fail'
  137.  
  138. // // const calculateArea = (width, height) => width * height
  139.  
  140. // // const result = calculateArea(5,4);
  141. // // const result = calculateGrade(score)
  142. // // console.log(result)
  143. // // const calculateArea = (width)=> (height) => width * height
  144.  
  145. // // const result = calculateArea(5)(4);
  146. // // console.log(result)
  147.  
  148. // //javascript object
  149. // const person ={
  150. // id:1,
  151. // name:'P',
  152. // age:23
  153. // }
  154. // //add
  155. // // person.isRich = true
  156.  
  157. // // console.log(person)
  158. // // console.log(person['name'])
  159.  
  160.  
  161. // // newperson same person
  162. // // const newPerson = person
  163. // // console.log (newPerson.name)
  164.  
  165.  
  166. // //Destructuring
  167. // // const {name,age} = person
  168. // // console.log (name)
  169. // // console.log (age)
  170.  
  171. // // const {name: newPerson,age} = person
  172. // // console.log (newPerson)
  173. // // console.log (age)
  174.  
  175. // //spread & rest operator ...
  176.  
  177. // person.isRich = true;
  178.  
  179. // const newPerson = {...person,isRich: true}
  180. // // const {name,isRich,...other} = newPerson
  181. // // console.log (name)
  182. // // console.log (isRich)
  183. // // console.log (other)
  184.  
  185. // //add result in array
  186. // const nums = [1,2,3,4]
  187.  
  188. // const numsWithFive = [...nums, 5]
  189.  
  190. // console.log(numsWithFive)
  191.  
  192. //Class
  193. class Person {
  194. constructor(id, name, age) {
  195. this.id = id;
  196. this.name = name;
  197. this.age = age;
  198. }
  199. }
  200.  
  201. const person = new Person(1, "mark", 34)
  202. console.log(person)
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225. </script></body>
  226. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement