So, I have this object containing country names as keys and the values are arrays with some cities. I want to get all the cities in one array, without the countries. Here's how I go about it and can't understand why it isn't working:  var...
I have a JavaScript Object and I'm sure the value of any key is an array (even empty in some case):  {key1:["a","b","c"],key2:["d","e","f"],key3:...}   Aside from using Underscore, is there any way...
I've got a problem, regarding gulp. I decided to automate the process of how the source and styles are compiled into a single file, so I decided to use gulp for that purpose. However, it doesn't want to overwrite the application.js file that...
I have this code which works good for this array: ['45', '30', '50', '1'].   function penalty(a_list) {   return a_list.sort((a, b) => a - b).join(''); }   for example: given that a_list is ['45', &#...
function whatTheHeck(obj){   var arr = []    for(o in obj){     arr.concat(["what"])   }    return arr }  whatTheHeck({"one":1, "two": 2})   The concat function completely fails to do anything. But if I put a breakpoint on tha...
I imagine this is similar to array padding, but I wonder if it can be simplified at all.  var arr = [1,2,3],     x   = 5;  for (var i=0; i<x; i++) {   arr.push(x); }  console.log(arr); //=> [1, 2, 3, 5, 5, 5, 5, 5]   Is there any way to do this...
So I installed npm using npm install uglify-js  I run a command which is:  cat file1.js file2.js .. fileN.js | uglifyjs -o files.min.js   and I get this error:  WARN: ERROR: Unexpected token eof «undefined», expected punc «,» [-:630,15]  /usr/loc...
I am attempting (unsuccessfully) to write JavaScript function LetterCount to count the consecutive letters in a string (and not the total number).   Ideally:     LetterCount("eeeeeoooohhoooee") = [["e", 5],["o",3],["h"...
I'd like to use grunt-contrib-concat for application frontend HTML templating purposes and this would be useful for me.  I'd like to define page partials and and concatenate them inside an output file that is going to be compiled by handlebar...
I want to write a method which filters data for multiple criteria. These criteria should by passed as functions to the filter-function, for example:  var products = [/* some data */]; function filterMyProducts(criteria) {    return products.filter(/*...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.