Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 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.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. </script>
  129.  
  130.  
  131.  
  132. <script id="jsbin-source-javascript" type="text/javascript">// // const score = 40;
  133.  
  134. // // if(score >= 50){
  135. // // console.log('pass')
  136. // // } else {
  137. // // console.log('fail')
  138. // // }
  139.  
  140.  
  141. // // ternary operator
  142.  
  143. // // let result = score >= 50 ? 'pass' : 'fail'
  144.  
  145. // // console.log(result)
  146.  
  147. // // function calculateGrade(score) {
  148. // // return score >= 50 ? 'pass' : 'fail'
  149. // // }
  150.  
  151. // // const calculateGrade = function(score) {
  152. // // return score >= 50 ? 'pass' : 'fail'
  153. // // }
  154.  
  155. // // const result = calculateGrade(score)
  156. // // console.log(result)
  157.  
  158. // // arrow fucntion
  159. // // const calculateGrade = (score) => score >= 50 ? 'pass' : 'fail'
  160.  
  161. // // const calculateArea = (width, height) => width * height
  162.  
  163. // // const result = calculateArea(5,4);
  164. // // const result = calculateGrade(score)
  165. // // console.log(result)
  166. // // const calculateArea = (width)=> (height) => width * height
  167.  
  168. // // const result = calculateArea(5)(4);
  169. // // console.log(result)
  170.  
  171. // //javascript object
  172. // const person ={
  173. // id:1,
  174. // name:'P',
  175. // age:23
  176. // }
  177. // //add
  178. // // person.isRich = true
  179.  
  180. // // console.log(person)
  181. // // console.log(person['name'])
  182.  
  183.  
  184. // // newperson same person
  185. // // const newPerson = person
  186. // // console.log (newPerson.name)
  187.  
  188.  
  189. // //Destructuring
  190. // // const {name,age} = person
  191. // // console.log (name)
  192. // // console.log (age)
  193.  
  194. // // const {name: newPerson,age} = person
  195. // // console.log (newPerson)
  196. // // console.log (age)
  197.  
  198. // //spread & rest operator ...
  199.  
  200. // person.isRich = true;
  201.  
  202. // const newPerson = {...person,isRich: true}
  203. // // const {name,isRich,...other} = newPerson
  204. // // console.log (name)
  205. // // console.log (isRich)
  206. // // console.log (other)
  207.  
  208. // //add result in array
  209. // const nums = [1,2,3,4]
  210.  
  211. // const numsWithFive = [...nums, 5]
  212.  
  213. // console.log(numsWithFive)
  214.  
  215. //Class
  216. class Person {
  217. constructor(id, name, age) {
  218. this.id = id;
  219. this.name = name;
  220. this.age = age;
  221. }
  222. }
  223.  
  224. const person = new Person(1, "mark", 34)
  225. console.log(person)
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248. </script></body>
  249. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement