/* console.log(greenjobs.length); */
/* console.log(_.identity(1)); */
const testdata = greenjobs.slice(0, 4);
/* console.log(testdata); */
/////////////////////////////////////////////////////////////////////
// greenJobInZipCode(data, zipcode). Return true if zipcode exists anywhere in address field.
function getAddresses(data) {
return _.pluck(data, 'Address');
}
function greenJobInZipCode(data, zipcode) {
const addresses = getAddresses(data);
return _.some(addresses, function(address) {
return address.includes(` ${zipcode}`);
});
}
/* console.log(getAddresses(testdata)); */
/* console.log(greenJobInZipCode(testdata, '96749')); */
/* console.log(greenJobInZipCode(testdata, '96999')); */
/* console.log(greenJobInZipCode(greenjobs, '00000'))
function greenJobInZipCodeES6(data, zipcode) {
const addresses = getAddresses(data);
return _.some(addresses, address => address.includes(zipcode));
} */
/* console.log(greenJobInZipCodeES6(testdata, '96999')); */
/////////////////////////////////////////////////////////////////////
// listIndustries(data). Returns a list of strings indicating all the industries providing green jobs (no duplicates).
function getIndustryFields(data) {
return _.pluck(data, 'Industry');
}
function listIndustries(data) {
return _.unique(getIndustryFields(data));
}
/* console.log(getIndustryFields(testdata)); */
/* console.log(listIndustries(testdata)); */
/* console.log(listIndustries(greenjobs)); */
/////////////////////////////////////////////////////////////////////
// countyGreenJobs(data). Returns an object where the keys are County names and the values are the number of Green Jobs listed in that County.
// 1. Group by county.
// 2. MapObject to change the array of jobs into an integer indicating the length of that array.
function groupJobsCounty(data) {
return _.groupBy(data, function(record) {
return record.County;
});
}
function countyGreenJobs(data) {
return _.mapObject(groupJobsCounty(data),...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.