Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- // // const score = 40;
- // // if(score >= 50){
- // // console.log('pass')
- // // } else {
- // // console.log('fail')
- // // }
- // // ternary operator
- // // let result = score >= 50 ? 'pass' : 'fail'
- // // console.log(result)
- // // function calculateGrade(score) {
- // // return score >= 50 ? 'pass' : 'fail'
- // // }
- // // const calculateGrade = function(score) {
- // // return score >= 50 ? 'pass' : 'fail'
- // // }
- // // const result = calculateGrade(score)
- // // console.log(result)
- // // arrow fucntion
- // // const calculateGrade = (score) => score >= 50 ? 'pass' : 'fail'
- // // const calculateArea = (width, height) => width * height
- // // const result = calculateArea(5,4);
- // // const result = calculateGrade(score)
- // // console.log(result)
- // // const calculateArea = (width)=> (height) => width * height
- // // const result = calculateArea(5)(4);
- // // console.log(result)
- // //javascript object
- // const person ={
- // id:1,
- // name:'P',
- // age:23
- // }
- // //add
- // // person.isRich = true
- // // console.log(person)
- // // console.log(person['name'])
- // // newperson same person
- // // const newPerson = person
- // // console.log (newPerson.name)
- // //Destructuring
- // // const {name,age} = person
- // // console.log (name)
- // // console.log (age)
- // // const {name: newPerson,age} = person
- // // console.log (newPerson)
- // // console.log (age)
- // //spread & rest operator ...
- // person.isRich = true;
- // const newPerson = {...person,isRich: true}
- // // const {name,isRich,...other} = newPerson
- // // console.log (name)
- // // console.log (isRich)
- // // console.log (other)
- // //add result in array
- // const nums = [1,2,3,4]
- // const numsWithFive = [...nums, 5]
- // console.log(numsWithFive)
- //Class
- class Person {
- constructor(id, name, age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
- }
- const person = new Person(1, "mark", 34)
- console.log(person)
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">// // const score = 40;
- // // if(score >= 50){
- // // console.log('pass')
- // // } else {
- // // console.log('fail')
- // // }
- // // ternary operator
- // // let result = score >= 50 ? 'pass' : 'fail'
- // // console.log(result)
- // // function calculateGrade(score) {
- // // return score >= 50 ? 'pass' : 'fail'
- // // }
- // // const calculateGrade = function(score) {
- // // return score >= 50 ? 'pass' : 'fail'
- // // }
- // // const result = calculateGrade(score)
- // // console.log(result)
- // // arrow fucntion
- // // const calculateGrade = (score) => score >= 50 ? 'pass' : 'fail'
- // // const calculateArea = (width, height) => width * height
- // // const result = calculateArea(5,4);
- // // const result = calculateGrade(score)
- // // console.log(result)
- // // const calculateArea = (width)=> (height) => width * height
- // // const result = calculateArea(5)(4);
- // // console.log(result)
- // //javascript object
- // const person ={
- // id:1,
- // name:'P',
- // age:23
- // }
- // //add
- // // person.isRich = true
- // // console.log(person)
- // // console.log(person['name'])
- // // newperson same person
- // // const newPerson = person
- // // console.log (newPerson.name)
- // //Destructuring
- // // const {name,age} = person
- // // console.log (name)
- // // console.log (age)
- // // const {name: newPerson,age} = person
- // // console.log (newPerson)
- // // console.log (age)
- // //spread & rest operator ...
- // person.isRich = true;
- // const newPerson = {...person,isRich: true}
- // // const {name,isRich,...other} = newPerson
- // // console.log (name)
- // // console.log (isRich)
- // // console.log (other)
- // //add result in array
- // const nums = [1,2,3,4]
- // const numsWithFive = [...nums, 5]
- // console.log(numsWithFive)
- //Class
- class Person {
- constructor(id, name, age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
- }
- const person = new Person(1, "mark", 34)
- console.log(person)
- </script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement