Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Data is everywhere
- //const, let/var
- //var - Never ever use var
- //const, let
- // const firstName = 'samim' //string
- // const age = 28 //number
- // const profession = 'web developer' //string
- // const isProgrammer = true //boolean
- // console.log(firstName, age)
- // console.log(
- // 'First Name ' + firstName + '.' + ' I am ' + age + ' I am a ' + profession
- // )
- // console.log(`First Name ${firstName}. I am ${age}. I am a ${profession}`)
- //array
- // const info = ['samim', 28, 'web developer', true]
- //length-4(start from 1)
- //accessing element (start from 0)
- // const index = info.length - 1
- // console.log(info[index])
- // console.log(`First Name ${info[0]}. I am ${info[1]}. I am a ${info[2]}`)
- //nested
- //object
- // const userInfo = {
- // firstName: 'samim',
- // age: 28,
- // profession: 'web programmer',
- // fullName: function () {
- // console.log(this.firstName)
- // },
- // isProgrammer: true,
- // random1: [1, 2, 3, 5],
- // random2: {
- // greet: 'hello'
- // }
- // }
- // userInfo.fullName()
- // const myAge = 'age'
- // console.log(userInfo[myAge])
- // console.log(userInfo.age)
- // console.log(userInfo['age'])
- // console.log(userInfo.random1[3])
- // console.log(userInfo.random2.greet)
- // console.log(
- // `First Name ${userInfo.firstName}. I am ${userInfo.age}. I am a ${userInfo.profession}`
- // )
- //Introduction to Function(code reuse)
- // function showInfo(num1, num2) {
- // console.log(num1, num2)
- //function body
- // return num1 + num2
- // }
- // console.log(showInfo(10, 5))
- // console.log(3 + 5)
- // console.log(10 + 5)
- // console.log(10 + 5)
- // console.log(10 + 5)
- // console.log(10 + 5)
- // console.log(10 + 5)
- // console.log(10 + 5)
- // function showBio(userInfo) {
- // return `First Name ${userInfo.firstName}. I am ${userInfo.age}. I am a ${userInfo.profession}`
- // }
- // const info = {
- // firstName: 'samim',
- // age: 28,
- // profession: 'web programmer',
- // isProgrammer: true,
- // random1: [1, 2, 3, 5],
- // random2: {
- // greet: 'hello'
- // }
- // }
- // console.log(showBio(info))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement