Tag: arrays

How to check multiple checkboxes with JavaScript?

I have multiple checkboxes <div class=”data”> <span> <input name=”employee” type=”checkbox” value=”Alex”/> <label for=”employee”>Alex</label> </span> <span> <input name=”employee” type=”checkbox” value=”Frank”/> <label for=”employee”>Frank</label> </span> <span> <input name=”employee” type=”checkbox” value=”Mark”/> <label for=”employee”>Mark</label> </span> </div> How to find all checked checkboxes and create json or array with result of checking?

List chromes registered service workers

Is there a way to list all the browsers registered service-workers? Lets say that I have registered/installed a few service workers. can I get a list an array of the file names via js?

How to serialize a JavaScript associative array?

I need to serialize an associative JavaScript array. It’s a simple form of products and a numeric values, but just after building the array seems empty. The code is here: http://jsbin.com/usupi6/4/edit

javascript: convert two dimensional array to array of objects using the first 'row' to define properties

In order to populate a data-grid that receives array of row objects, I am looking for a good solution to convert an array such as this: [ [‘country’, ‘population’], [‘someplace’, 100], [‘otherplace’, 200] ] into an array of objects such as this: [ {country: ‘someplace’, population: 100}, {country: ‘otherplace’, population: 200}, ] UPDATE: this is […]

Remove an item from a copy of an array without removing it from the original array

How can I remove an object from a copy of an array without removing it from the original? I have a global variable : var userTrickList = []; And inside a function, I make a copy of that global array : var tempUserTrickList = userTrickList; Then I use the removeItem function that I created to […]

Why for-in iterates through array methods also?

on a page I use similar syntax to google analitycs code, to pass parameters to another script. I iterate through the array and try to construct query part of URL according to the parameters in the included script. The problem is the following iterates through the javascript array objects methods also and mess up resulting […]

How to remove a value from array? javascript

I create an object thus: var savingArray = new Array({doctorId: “something”, username: “something”, password: “something”, givenName: “something”, familyName: “something”, address: “something”, zip:”something”, emailAddress: “something”, phoneNumber: “something”, labs: “something”, defaultLab: “something”}); Now i wish to remove every value of objects…I would like to end up with savingArray such that: savingArray == ({doctorId: “”, username: “”, password: […]

Parse Javascript Array

Hey all. Newbie JavaScript question here. I have an array: {r=1, g=4, b=6} How do i go about getting the value of each (r,g,b) into a separate variable?

JavaScript – Compare two arrays

This question already has an answer here: Javascript: efficiently compare two integer arrays 6 answers

Deleting a user in an Array

kyler decides to delete his account. Loop through your array of objects until you find kyler’s account – use kyler@test.com to find him in the array. Once you find the particular index he’s located in, delete him from the array. var users = [{ name: ‘talon’, email: ‘talon@test.com’, password: ‘test1234’, username: ‘tdog’, },{ name: ‘lauren’, […]