0% found this document useful (0 votes)
8 views

Notes JS-4

Uploaded by

jtomm2covj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Notes JS-4

Uploaded by

jtomm2covj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

// add new or update property

dict["Age"] = 42;

// direct property by name


// because it's a dynamic language
dict.FirstName = "Chris";
for(var key in dict) {
var value = dict[key];

Since JavaScript is a functional language, functions are objects too. As a result,


Functions can also be used as either Key and/or Value on your dictionary
var dict = {};

var f = function() {
// do something
};

// setup Function as Value


dict['method'] = f;

// setup Function as Key


dict[f] = 'some value';

// execute Function from Value


dict['method']();

var method = dict.method;


method();

// get value for Key


var val = dict[f];
The main difference between the two operators is how they compare values.
The == operator compares the values of two variables after performing type
conversion if necessary. On the other hand, the === operator compares the
values of two variables without performing type conversion.

How to check if a person is workig in Circle Office


EmployeesArray.includes(“suresh”). // returns true/false

You might also like