Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Let's Talk to Computer
- // Everything is data....
- // I am samim, I am 30, I am a programmer
- //Checking data type
- // I
- // am
- // samim
- // 30
- // a
- // programmer
- // Declaring variable
- // *Rules- camelCasing, pascalCase
- // let, var, const
- // Javascript Data type
- // primitive
- // - string
- // - number
- // - boolean(true, false)
- // - undefined
- // - null
- // - Symbol
- // - Bigint
- // Object/complex data type
- // - array
- // - object
- // - function
- //labelling data(variable)/container
- //naming variable
- // Variable names cannot contain spaces.
- // Variable names must begin with a letter, an underscore (_) or a dollar sign ($).
- // Variable names can only contain letters, numbers, underscores, or dollar signs.
- // Variable names are case-sensitive.
- // special (reserved keyword array not allowed)
- //var,let,const
- // const firstName = 'samim' //string (anything wrapped in single or double quote
- // const age = 3 //number
- // var profession = 'programmer'//(Don't use)
- //always declare with const
- //data type
- //primitive
- const firstName = 'samim' //string
- const age = 3 //number
- const isDeveloper = true //(boolean)
- const isMachineEngineer = undefined //(Never use)
- const isDesigner = null
- // const randValue = Symbol() //generate unique value
- // const bigNum = 1212313n //bigint
- //complex/object data type
- //array
- // const person = ['samim', 30, true, null]
- // console.log(person[0], person[1])
- const personObj = {
- name: {
- first: 'samim',
- last: 'Hasan'
- },
- age: [30, 40, 20],
- isDeveloper: true,
- isDesigner: null,
- }
- //object
- personObj.name.first = 'anis'
- personObj.location = 'Dhaka'
- console.log(personObj)
- //accessing property /key
- console.log(personObj.name.first)
- console.log(personObj['firstName'])
- console.log(personObj.age[2])
- console.log(personObj.isDeveloper)
- //function
- //will be discussed later
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement