I need the fastest way to get the first day of the week. For example: today is the 11th of November, and a Thursday; and I want the first day of this week, which is the 8th of November, and a Monday. I need the fastest method for MongoDB map functi...
Code in question with syntax highlighting here: via Friendpaste  rot13.js:     ERRONEOUS  <script> String.prototype.rot13 = rot13 = function(s)  {     return (s = (s) ? s : this).split('').map(function(_)      {         if (!_.match(/...
I've seen versions of this question for other languages, but not for JS.  Is it possible to do this recursively in one function?  I understand that I need to take the first element in the string, and then append it to each solution to the recur...
I've created a site for an artist friend of mine, and she wants the layout to stay the same, but she also wants new paintings she'd produced to be mixed into the current layout.  So I have 12 thumbnails (thumb1 - thumb12) on the main gallery...
I am trying rewrite code from JS to Java. The code is Diamond square algorithm.  Source is: http://www.playfuljs.com/realistic-terrain-in-130-lines/  I rewrite code, but my code not working...  Output is bad.   My code in Java is:  public class MapGe...
I'm trying to get the nth root of a number using JavaScript, but I don't see a way to do it using the built in Math object. Am I overlooking something? If not...  Is there a math library I can use that has this functionality? If not...  What&...
I have a function that called with other objects and  when my application is loaded, get parameter and the function should wait for call with all of object and then execute so with promises pattern i can  ensure all object is loaded but i don't k...
Say, if I wanted to generate an unbiased random number between min and max, I'd do:  var rand = function(min, max) {     return Math.floor(Math.random() * (max - min + 1)) + min; };   But what if I want to generate a random number between min and...
If I have an array like this:  var array = [1, 3, 4, 5, 9, 10];   And I have a value like this:  var value = 8;   I want to get this result:  var result = getClosestValues(array, value); // [5, 9]   What's the correct/preferred way to do this in...
I am trying to have fun with my buddy who solved the problem mentioned in 8m 7s, and for me it is already 20m gone. I can't figure out how to handle unlimited nested array in javascript.  The problem is this:  // i will be an array, containing in...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.