I need javascript to add 5 to an integer variable, but instead it treats the variable as a string, so it write out the variable, then add 5 onto the end of the "string". How can I force it to do math instead? var dots = document.getElement...

How do I parse and evaluate a mathematical expression in a string (e.g. '1+1') without invoking eval(string) to yield its numerical value? With that example, I want the function to accept '1+1' and return 2....

According to Google Calculator (-13) % 64 is 51. According to Javascript (see this JSBin) it is -13. How do I fix this?...

Want to improve this post? Provide detailed answers to...

Why when I use this: (assuming i = 1) divID = "question-" + i+1; I get question-11 and not question-2?...

Hi I am trying to solve a math problem where I take a number e.g. 45, or 111 and then split the number into separate digits e.g. 4 5 or 1 1 1. I will then save each number to a var to run a method on. Does anyone no how to split a number into indiv...

Looking for a really fast implementation of factorial function in JavaScript. Any suggests?...

I need to evaluate user-entered arithmetic expressions like "2 * (3 + 4)" in Javascript but I don't want to use eval for security reasons. I could strip out all the characters that are not numbers or operators but I'm not sure thi...

How i can calculate the date in javascript knowing weeknumber and the year? For week number 20 and year 2013 to obtain 5/16/2013 I am trying so: Date.prototype.dayofYear = function() { var d = new Date(this.getFullYear(), 0, 0);...

My question is: given a target RGB color, what is the formula to recolor black (#000) into that color using only CSS filters? For an answer to be accepted, it would need to provide a function (in any language) that would accept the target color as...

©2020 All rights reserved.