Javascript Data Types | Javascript Objects

TECHNOLOGY

Data types and objects are the basic keywords that are required by any language. Javascript holds a variety of data types that are easy to use.

 

 

Loosely Typed Language

Javascript provides dynamic data types (it is loosely typed language),Guest Posting it means we don’t need to define the type (whether it is integer or string), whatever we assign at the time of assignment it accepts its type as its data type.

Example:

var a = 5

Here we have assigned an integer, so it will take an integer as its data type.

 

Dynamic Typing

 In Javascript, we can also explicitly change the data type of a variable. 

Example – :

var a = 5;

a = “String”

Here at first, we have assigned an integer in variable ‘a’ so it takes an integer as its data type. But in the next line, we assign a string value. This does not give an error in javascript, we can explicitly change the data type of variable.

 

Javascript has some own rules for converting the data type implicitly. 

 

Example -: 

var a = “String” + 5   // ‘+’ symbol is used for concatenation in javascript

console.log(a)          // prints “String5”

Here Javascript implicitly converts the data type to string even there is an integer involved.

 

These are some of the basics of how javascript data types work.

 

Let’s move into the different Javascript data types.

 

Javascript Data types

There are basically two types of data types Primitives and Objects. Primitives data types are the types that define the type of a variable and has no methods, unlike objects.

 

The primitive Javascript data types are -:

  1. Boolean 
  2. Number
  3. String
  4. Null 
  5. Undefined

 

Boolean:

The boolean value can be true or false and 0 or 1. If we assign any of these values to a variable it is defined as boolean.

 

var a = true

var b = false

 

Number:

Any number integer or a float value comes into the data type number. The numbers can also be +Infinity, -Infinity and Nan (not a number). It is a double-precision 64-bit binary format number, which means the value lies between ((2^(-53))-1  – (2^53) -1) that occupies the whole 64 bit in a system.

 

var a = +Infinity

 

String:

A string is a group of characters generally text, it can store any type of character. The Strings are initialized within double quotes (“”).

 

var a = “This is a String 12345”

 

Null:

Null is a data type which means nothing. Null is assigned to a variable when the variable is empty. 

var a = null

 

Undefined:

The value of an empty variable is Undefined.

var a

console.log(a)     //undefined

 

Javascript Objects:

An Object holds a memory denoted by an identifier that contains different types of properties. Properties are the key-value pair, keys can be a string or symbol and values can be of any type. Values can be string, integer or even the javascript objects itself, which helps in handling complex data. The Object is not a primitive javascript data types so, it comes with different inbuilt methods.

Example -:

var a = {

num : 0,

key : “String”

}

 

Here, a is an object that has keys ‘num’ and ‘key’. The values associated with these keys are ‘0′ and ‘String’ respectively.

 

Functions as Objects:

When a function is defined it inherits the built-in properties because of its prototype. These are the various properties associated with a function that makes our work easier.  

Example -:

        function myFunc (param1, param2, param3){

//Body of a function

        }

        console.log(myFunc.length)      // returns the number of parameter the function holds

 

Similarly, there are properties as well that are associated with a function.

 

Example:-  .call(), .apply() etc.

 

Arrays as Objects:

Arrays defined can be treated as an object since arrays inherit a bunch of inbuilt properties from its prototype. Arrays inherit the methods or properties from Array.prototype that helps to manipulate the array. ECMAScript has provided us with a lot of functionalities that can be implemented by treating the array as an object.

 

Example -:  

array.map((value, index) => { return //body  })

array.forEach((value, index) => { return //body  })

array.filter((value, index) => { return //body  })

array.length

array.slice()

array.splice()

array.push()

array.pop()

and many more …

 

Map and Set:

Till now, we have learned how to store complex data

  1. Arrays – that uses ordered collection of data that can be accessed by indexes.
  2. Objects – it uses keys to store the collection of data

 

But, these are not enough to deal with real-life scenarios, that is why maps and sets were introduced.

 

Maps:

Maps store the key-value pair same as object, but the difference is, maps can store any type of keys whereas objects were able to store only string keys.

 

Methos and Properties of maps are -:

new map() – It will create a new map

map.set(key, value) – It stores the key-value pair

map.get(key) – It gets the value associated key in a map

map.has(key) – Checks whether the key is defined if it does not then return undefined

map.delete(key) – It removes the key-value pair associated with the key.

map.clear() – It removes all key-value pairs from the map

map.size() – returns the count of the key-value pair

map.keys(), map.values() and map.entries are used for the iteration of the map object.

 

Example -:

let map = new Map();

 

map.set(‘1’, ‘str1’);

map.set(1, num1);

map.set(true, ‘bool1’);

 

Sets:

Set is a set of values without keys. Set is used to store a value only once if we store the same value repeatedly, it will do nothing.

Sets can be iterated with the help of forEach and inbuilt functions as set.keys(), set.values() and set.entries.

 

The methods of the set are -:

set.add(value) – adds a value to a set

set.delete(value) – delete a value from a set

set.has() – checks if the value is present in the set, returns true or false

set.clear() – removes all the values from a set

Set.size – return the count of values in a set

 

Example -:

let set = new Set();

let jhon = { name : “Jhon”};

let pete = { name : “Pete” };

let mary = { name : “Mary” };

 

set.add(jhon);

set.add(pete);

set.add(mary);

 

JSON Object:

Suppose there is a complex object or an array that we want to send over a network. We know that data transferred through the network is in the form of bytes, so we will not be able to transfer data in one go. JSON objects enable us to send the data through a network in the form of a string. Using JSON methods we can convert any array or object into the JSON object and can send over a network, on the receiving end we can again convert it back to array or object by using JSON methods. 

 

Example-:

Suppose we have a object

var a = {

name : “name”,

company_name : “company_name”,

address : “address”

}

 

We can convert this object into the JSON object by using JSON.stringify() method.

var json = JSON.stringify(a);

This JSON object is then sent over a network.

At the receiving end again we have to convert it back to the object then we use JSON.parse()

var obj = JSON.parse(json);

 

This is all one has to learn about Javascript Data Types and Javascript Objects.


Be it a software developer, programmer, coder, or a consultant, CronJ has it all. CronJ has been a trustworthy company for startups, small companies, and large enterprises. Hire the web of experienced ReactJS Development Services for your esteemed project today.

 

Hope you enjoyed learning it.

Thank you!!

Source: Free Guest Posting Articles from ArticlesFactory.com

Contact Us

  • India Job Seekers
    3, First Floor, Maruthanayagam Pillai Complex, LIC Colony, KK Nagar, Trichy - 620021
  • +91 97905 55741

Quick Links

Job Categories

Job Categories

jobs near me | amazon jobs | jobs hiring near me | job alert | fast job | work from home jobs | part time jobs near me | government jobs | freelance | civil service jobs | online jobs | free job alert | work from home | apprenticeship | linkedin jobs | sbi careers | remote jobs | google jobs | part time jobs | employment | data entry jobs | google careers | amazon force | hiring near me | job search | data analyst | job vacancy | part time | software engineer | data scientist | jobs hiring | receptionist | freelance jobs | apple home advisor | majhi naukri | railway recruitment | side hustle | virtual assistant jobs | latest govt jobs | monster jobs | administrative assistant | microsoft careers | accenture careers | marriott careers | software developer | online jobs for students | free job | account manager | fast job search | post office recruitment | job bank | amazon jobs near me | apple jobs | deloitte careers | find a job | tesla careers | cashier | job alert | highest paying jobs | apple careers | receptionist jobs near me | job application | vacancies | naukri jobs | amazon work from home | icici careers | all jobs for you | online data entry jobs | full time jobs near me | qatar airways careers | aps jobs | online jobs from home | ibm careers | fci recruitment | emirates careers | sbi recruitment | glassdoor jobs | cvs careers | flight attendant jobs | trade me jobs | infosys careers | tesla jobs | work up job | government job vacancies | amazon delivery jobs | assam rifles recruitment | job seeker | work from home jobs near me | it jobs | job openings near me | govt job alert | wells fargo careers | work abroad | devnetjobsindia | railway recruitment | financial analyst | indigo careers | bsf recruitment | mechanical engineering jobs | data entry jobs from home | best jobs | government jobs | security jobs | online teaching jobs | sbi recruitment | civil engineering jobs | bank of america careers | marketing jobs | post office recruitment | apna job | jop | customer service jobs | wipro careers | upwork jobs | post office recruitment | business development manager | salesforce careers | gov jobs | rbi office attendant | construction jobs | job opportunities | assistant manager | crpf recruitment | pwc careers | customer service representative | hubstaff talent | public jobs | marketing manager | microsoft jobs | onlinedataentryjob | ey careers | transcription jobs | cisf recruitment | operations manager | sales executive | devnetjobs | amazon hiring | amazon delivery driver | remote jobs near me | railway jobs | jobs from home | amazon near me | dream job | airport jobs | amazon fulfillment center | government vacancies | kpmg careers | jp morgan careers | amazon work from home jobs | part time work from home jobs | call center jobs | cyber security jobs | kvs recruitment | mhc recruitment | executive assistant | online work from home | delivery driver jobs | flipkart careers | online jobs work from home | hr jobs | blue collar jobs | online tutoring jobs | amazon application | job sites | babysitting jobs | freelance writing jobs | online job 715 | job search sites | army jobs | cvs jobs | freelancing websites | human resources jobs | great job | barc recruitment | office work | india post recruitment | office jobs near me | ui ux designer | driving jobs near me | graphic design jobs | free alert job | recruitment online | axis bank career | recruitment agencies | transcribe me | digital marketing jobs | data analyst jobs | ibegin tcs | indian post recruitment | cognizant careers | medical assistant jobs | security jobs near me | cabin crew jobs | receptionist jobs | capgemini careers | qa engineer | iocl recruitment | latest job | account executive | computer science jobs | ikea jobs | graduate jobs | hilton careers | dfccil recruitment | online part time jobs | accounting jobs | icici bank career | career explorer | indian railway recruitment | majhi naukri | kormo jobs | babysitting jobs near me | post office vacancy | teaching jobs near me | online work | ppsc jobs | get a job | job centre | spotify careers | railway recruitment | central government jobs | management trainee | gulfwalkin | itbp recruitment | apprenticeships near me | agriculture jobs | brand manager | amazon remote jobs | new job | driving jobs | dfccil recruitment | iocl recruitment | job center | online typing jobs | we work remotely | fiverr jobs | engineering jobs | undp jobs | top jobs | job vacancy near me | construction worker | morgan stanley careers | fci recruitment | spotify jobs | cleaning jobs near me | nursing jobs near me | summer jobs | weworkremotely | cruise ship jobs | delivery jobs near me | cag recruitment | hdfc careers | drdo recruitment | bhel recruitment | part time remote jobs | data entry work from home | psc recruitment | uber careers | amazon flex driver | siemens careers | teaching jobs | finance jobs | security guard jobs | easy typing job | customer success manager | sbi po apply online | network rail jobs | electrical engineering jobs | pepsico careers | construction jobs near me | amazon driver jobs | oracle careers | job websites | pilot jobs | private job | proofreading jobs | project coordinator | system engineer | personal assistant jobs | business development executive | stay at home jobs | hsbc careers | standard bank careers | itbp recruitment | freshersvoice | home office jobs | best paying jobs in finance | ib recruitment | student at work | air force jobs | jobs hiring near me part time | salesforce jobs | amazon jobs from home | ib recruitment | ntpc recruitment | teaching assistant jobs | barc recruitment | twitter careers | remote jobs hiring | medical assistant jobs near me | esic recruitment | ubs careers | business analyst jobs | zoho careers | barclays careers | employment agencies | biotechnology jobs | creative jobs | ongc recruitment | jobsplus | dsssb vacancy | part time jobs for students | data science jobs | ssb recruitment | business administration jobs | world bank jobs | sales assistant | hal recruitment | delivery jobs | bank jobs near me | english teacher | full time jobs | indian coast guard recruitment | student job search | income tax recruitment | linkedin careers | salesforce developer | hotel jobs | administrative assistant jobs | aavin recruitment | naukri gulf | esic recruitment | typing jobs | all jobs | chase careers | maruti suzuki career | aws jobs | system analyst | cisco careers | accenture jobs | citibank careers | drdo recruitment | chemical engineering jobs | hotel jobs near me | vedantu careers | project manager jobs | production manager | new vacancy | good jobs | office assistant | noc canada | psychology jobs | night shift jobs | white collar jobs | online money earning | aai recruitment | canada post jobs | paypal careers | bartending jobs near me | hiresine | navy recruitment | freelance writing | typing jobs from home | post office vacancy | healthcare jobs | job advertisement | defence job | hdfc bank careers | adobe careers | siemens jobs | overnight jobs near me | accor careers | housekeeping jobs | high paying jobs near me | nursing jobs | ksp recruitment | honeywell careers | electrician jobs | cleaning jobs | medical representative | data entry operator | office jobs | mhada recruitment | sales engineer | pepsico jobs | logistics jobs | data entry jobs work from home | vectrus careers | credit suisse careers | arts jobs | bank of america jobs | p&g careers | accounting jobs near me | sales jobs | amazon online jobs | pharmacist jobs | state jobs | ford careers | good paying jobs | home based jobs | application for employment | deloitte jobs | dell careers | real estate jobs | mes recruitment | night jobs near me | call center jobs near me | rpa developer | cashier jobs near me | appen jobs | wells fargo jobs | bel recruitment | computer operator | top job | aai recruitment | mhada recruitment | lic recruitment | infopark jobs | linkingsky | forklift operator | local jobs | sbi clerk apply online | nestle careers | remote work from home jobs | staff nurse vacancy | remote customer service jobs | unilever careers | tcs recruitment | job openings | environmental jobs | amazon employment | enggwave | nabard recruitment | flipkart jobs | creative circle | stackoverflow jobs | factory jobs near me | sap careers | job fairs near me | hckrecruitment | hospital jobs | work from home jobs without investment | writing jobs | ibm jobs | journalism jobs | machine operator | cisco jobs | environmental science jobs | jobs for freshers | hcl careers | airbnb careers | sap jobs | medical transcriptionist | best paying jobs | gis jobs | blackrock careers | part time jobs from home | i need a job | government job vacancy | psu jobs | relationship manager | work from home jobs no experience | software engineer jobs | hr jobs near me | stripe careers | job vacancies | jobassam | bookkeeping jobs | overnight jobs | public relations jobs | ssb recruitment | part time work near me | emirates group careers | sbi recruitment | truck driving jobs | public service commission jobs | igcar recruitment | sbi clerk apply online | admin jobs | olx jobs | manpower jobs | vistara careers | find an apprenticeship | remote data entry jobs | social media jobs | marriott jobs | ikea careers | it jobs near me | npcil recruitment | intel careers | new jobs | research assistant jobs | job offer | kvs vacancy | hospitality jobs | territorial army recruitment | sbi vacancy | amazon hiring near me | job boards | hgv driver jobs | government jobs | aai recruitment | becil recruitment | lionbridge jobs | sales jobs near me | pwc jobs | tamilanguide | career change | it technician | information technology jobs | airline jobs | medical coding jobs | vmware careers | job posting | night shift jobs near me | interior design jobs | etihad careers | job market | unacademy careers | best work from home jobs | indgovtjobs | tata steel career | healthcare administration jobs | cg govt job | student jobs | aviation jobs | microbiology jobs | transcriber | highest paying jobs in the world | data entry jobs near me | hgv jobs | hospital jobs near me | summer jobs near me | myntra careers | bloomberg careers | up police vacancy | computer engineer | forklift jobs | amazon customer service jobs | intel jobs | web developer jobs | jll careers | business intelligence analyst | wfh jobs | psc jobs | railway vacancy | bel recruitment | housekeeping jobs near me | transcriptionist | bmw jobs | nmdc recruitment | job search engines | good work | no experience jobs | railway jobs | psssb recruitment | typist | best paying jobs in basic industries | looking for a job | management jobs | sbi recruitment apply online | administrative officer | startup jobs | government jobs near me | freelance work | job agencies near me | latest govt jobs | us bank careers | forklift jobs near me | nature jobs | trade jobs | good paying jobs near me | train driver jobs | online jobs for students to earn money at home | graduate schemes | deutsche bank careers | part time work from home | work from home jobs for freshers | front desk jobs near me | dubizzle jobs | vacancy | tutoring jobs | admin jobs near me | amazon part time jobs | air force vacancy | paytm careers | senior manager | bank recruitment | npcil recruitment | indian railways recruitment | union jobs | computer technician | today jobs | copywriting jobs | iaf recruitment | delivery driver | oracle jobs | ux researcher | coinbase careers | legal jobs | information security analyst | amazon distribution center | supply chain manager | infosys recruitment | no experience jobs near me | delivery driver jobs near me | cbre careers | tamilan jobs | supply chain management jobs | punjab police jobs | manager jobs near me | category manager | new vacancy | all job for you | mba jobs | green jobs | social worker jobs | market research analyst | twitter jobs | data scientist jobs | online part time jobs for students | lorry driver | workday careers | swiggy careers | iqvia careers | side jobs | at home jobs near me | new job alert | social media manager jobs | zomato careers | registered nurse jobs near me | administration jobs | oil and gas jobs | procurement manager | shine jobs | nmdc recruitment | jobline | electrician jobs near me | amazon job application | free job posting sites | genpact careers | offcampusjobs4u | jobs around me | biomedical engineering jobs | igcar recruitment | security officer | online data entry | nielit recruitment | jobs abroad | iti jobs | gulf jobs | axis bank recruitment | best paying jobs in technology | hdfc bank recruitment | fao jobs | us postal service jobs | best job search engines | nvidia careers | icici bank recruitment | slack careers | whitehat jr jobs | study job line | admin assistant | adp careers | trainee train driver | job hunting | work from home jobs for students | southern railway recruitment | cvs application | online writing jobs | tech mahindra careers | army jobs | it engineer | sap consultant | amazon recruitment | byju's jobs | highest paying jobs without a degree | police jobs | ppsc jobs | safety officer jobs | cg job | online jobs no experience | texco vacancy | nithra jobs | hiring manager | online jobs near me | tcs jobs | engineering manager | data entry clerk | production assistant | public service jobs | assam rifles recruitment | hssc recruitment | jobs | abb careers | income tax department recruitment | local jobs near me | freelance jobs online | nyks recruitment | education jobs | find a job gov | adnoc careers | employment agencies near me | apple work from home | shell careers | quality engineer | hilton jobs | international relations jobs | librarian jobs | india post recruitment | job recruitment | department of health vacancies | career options | kpmg jobs | ntpc recruitment | job search websites | credit analyst | kbr careers | zoom careers | cs jobs | railway recruitment apply online | self employed jobs | intelligence bureau recruitment | nestle jobs | career choices | remote working jobs | sales development representative | people first jobs | medical jobs | analyst jobs | night jobs | vodafone careers | overseas jobs | upsc recruitment | uber jobs | madras high court recruitment | part time work | ncl recruitment | procurement jobs | online jobs hiring | bandhan bank recruitment | social media marketing jobs | communications jobs | aavin recruitment | linkedin job search | offline vacancy | chemistry jobs | qatar careers | software developer jobs | pharmacist jobs near me | mechanic jobs near me | mastercard careers | financial analyst jobs | medical transcription jobs | visa careers | amazon apply | job applications near me | aws careers | medical receptionist jobs | supply chain jobs | call center agent | front end developer jobs | staff nurse | coding jobs | easy jobs | intelligence bureau recruitment | public administration jobs | jobs for introverts | tuition teacher | bro recruitment | hotel career | wipro recruitment | marketing jobs near me | construction manager | staff nurse vacancy | jobs near me for freshers | yes bank careers | list of jobs | tamilan guide | ey jobs | remote nursing jobs | marketing specialist | byju's careers | office assistant jobs | govt jobs | freelancing sites | marketing coordinator | fiverr freelance | railroad jobs | office worker | aavin recruitment | oil india limited recruitment | hr specialist | job net | paypal jobs | clerical work | abbott careers | careers near me | digital marketing manager | security guard jobs near me | offshore jobs | canada post careers | side hustle jobs | job agencies | nhpc recruitment | psc vacancies | ongc recruitment | shop assistant | cvs health careers | bp careers | cash jobs near me | accounts payable jobs | kpsc recruitment | railway vacancy | recruitment consultant | amazon flex jobs | marketing assistant | oil india recruitment | intuit careers | remote accounting jobs | qualcomm careers | health career | pharmaceutical sales jobs | airbus careers | virtual jobs | jkssb recruitment | local truck driving jobs | modeling jobs | psc vacancies | delivery manager | executive assistant jobs | kotak mahindra bank career | ossc recruitment | government vacancies | anz careers | border force jobs | computer teacher vacancy | gail recruitment | chef jobs | job postings | idbi bank recruitment | local government jobs | sales coordinator | private bank jobs | oil rig jobs | flipkart job vacancy | first job | caterpillar careers | best jobs in the world | jpmorgan chase careers | kbr jobs | flydubai careers | engineering apprenticeships | maersk careers | air arabia careers | business jobs | science jobs | qa analyst | etihad airways careers | post office recruitment apply online | product manager jobs | senior consultant | mes jobs | ppsc online apply | senior software engineer | teleperformance jobs | cargill careers | hr assistant jobs | hostess jobs near me | sbi recruitment apply online | day labor near me | job apps | health and safety jobs | teacher vacancy | top jobs | all govt jobs | social work jobs near me | computer engineering jobs | indian railways recruitment | operations manager jobs | best part time jobs | best remote jobs | manufacturing jobs | career times | public sector jobs | philips careers | cashier jobs | amazon india careers | front desk receptionist | research jobs | procurement specialist | job hiring | customer service jobs near me | online data entry jobs without investment | online jobs for students to earn money | work near me | amazon delivery driver jobs | full stack engineer | new job vacancy | offline vacancy | hr assistant | axis bank recruitment | concentrix jobs | jobs hiring near me full time | sales clerk | office work near me | tech jobs | side jobs from home | tnstc recruitment | employment opportunities | gov nokri | world bank careers | service delivery manager | best freelance websites | iti jobs beta | chase bank careers | airbnb jobs | low stress jobs | aiims recruitment | clara jobs | air canada careers | new govt jobs | airtel careers | atlassian careers | bus driver jobs | cyber security analyst | computer jobs | bank of baroda recruitment | general motors careers | medical billing and coding jobs | vacancy near me | medical receptionist | kormo | freelance graphic designer | find jobs near me | job shop | workday jobs | pgcil recruitment | logistics manager | stripe jobs | khaleej times jobs | product specialist | digital marketing specialist | concentrix careers | job ideas | workindia job | real estate jobs near me | legal secretary | online english teaching jobs | translator jobs | dice jobs | technician jobs | night auditor | work from home customer service jobs | biology jobs | bnp paribas careers | logistics coordinator | job desk | emaar careers | nlc careers | truck driving jobs near me | amazon glassdoor | reliance careers | merchant navy jobs | fleet manager | digital nomad jobs | security analyst | cvs hiring | jobkind | law jobs | oil india recruitment | bsf recruitment | amazon canada jobs | indian coast guard recruitment | baker hughes careers | resdex naukri | barclays jobs | application engineer | best online jobs | product marketing manager | rpf vacancy | wellsfargo careers | rbi careers | room attendant | rotana careers | project coordinator jobs | al futtaim careers | indian railway jobs | jobs after 12th | ernst and young careers | media jobs | unilever jobs | executive engineer | amazon career day | chef jobs near me | marketing analyst | acting jobs | international jobs | drdo recruitment | ubs jobs | design jobs | traffic control jobs | reed recruiter | amazon recruitment | inova careers | legal assistant jobs | kpsc recruitment | hotel manager | astrazeneca careers | upsc vacancy | department of education jobs | tata motors career | fast jobs | brand ambassador jobs | coal india recruitment | canadian job bank | lorry driver jobs | payroll jobs | factory worker | carpenter work | healthcare management jobs | google work from home | online data entry jobs without investment daily payment | home based work | cag recruitment | kmf recruitment | government jobs after 12th | graphic design jobs near me | top paying jobs | best jobs for introverts | apprenticeship programs | noc engineer | ecil recruitment | industrial engineering jobs | sbi careers | job centre online | online jobs without investment | exxonmobil careers | property management jobs

© 2024 India Job Seekers.