Latest questions in Java

0 votes
0 answers

How can I find the prime factors of an integer in JavaScript?

Using a for loop in javascript, I was attempting to determine the prime factors of a number, denoted as 'integer' below.  I can't seem to get it to work, and I'm not sure if it's because of my JavaScript or my calculating logic. //integer is the value for which we ...READ MORE

Dec 12, 2022 in Java by Nicholas
• 7,760 points
797 views
0 votes
0 answers

Generate pdf from HTML in div using Javascript

I have the following HTML code: <!DOCTYPE html> <html> ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
829 views
0 votes
0 answers

Loop over an array in JavaScript

How can I use JavaScript to loop ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
457 views
0 votes
0 answers

How do I get the current time only in JavaScript

In JavaScript, how can I retrieve the ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
413 views
0 votes
0 answers

Which is better: <script type="text/javascript">...</script> or <script>...</script>

Which is more effective or convenient  ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
260 views
0 votes
0 answers

JavaScript: undefined !== undefined?

When I first tried to access Facebook API operations after integrating Facebook Connect with Tersus, I received the error messages Invalid Enumeration Value and Handler already exists. It was discovered that the source of the problem was object.x === undefined When there is no property 'x' in 'object,' returns false. I solved the problem by substituting normal equality for rigorous equality in two Facebook functions: FB.Sys.isUndefined = function(o) { return ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
330 views
0 votes
0 answers

Const in JavaScript: when to use it and is it necessary?

In JavaScript, I recently came across the ...READ MORE

Dec 8, 2022 in Java by Nicholas
• 7,760 points
218 views
0 votes
0 answers

How to add days to Date?

How can I add days to the ...READ MORE

Dec 8, 2022 in Java by Nicholas
• 7,760 points
223 views
0 votes
0 answers

How to stop timer in javascript?

I'd want to end a timer by clicking a button, but I can't figure out how.  I tried using clearInterval() to halt a timer, but I'm not sure whether it was called correctly. This is my current code. <html> <head> <title>Bootstrap</title> ...READ MORE

Dec 8, 2022 in Java by Nicholas
• 7,760 points
683 views
0 votes
0 answers

Convert a number into a Roman numeral in JavaScript

What is the best way to convert integers to roman numerals? function romanNumeralGenerator (int) { } Consider the following sample inputs and outputs: 1 = "I" 5 = ...READ MORE

Dec 8, 2022 in Java by Nicholas
• 7,760 points
671 views
0 votes
0 answers

How do I remove an object from an array with JavaScript?

I have a JavaScript object that looks ...READ MORE

Dec 8, 2022 in Java by Nicholas
• 7,760 points
225 views
0 votes
0 answers

How to get the current London time and date using javascript

Using the code below, I attempted to& ...READ MORE

Dec 7, 2022 in Java by Nicholas
• 7,760 points
735 views
0 votes
0 answers

How is a JavaScript hash map implemented?

I'm using OpenLayers right now and need ...READ MORE

Dec 7, 2022 in Java by Nicholas
• 7,760 points
233 views
0 votes
0 answers

Check if a value is an object in JavaScript

How do you check if a value ...READ MORE

Dec 7, 2022 in Java by Nicholas
• 7,760 points
223 views
0 votes
0 answers

How does the "this" keyword work, and when should it be used?

I'm trying to figure out what the&nbs ...READ MORE

Dec 7, 2022 in Java by Nicholas
• 7,760 points
381 views
0 votes
0 answers

What is the meaning of polyfills in HTML5?

Actually, I have no idea what polyfills ...READ MORE

Dec 7, 2022 in Java by Nicholas
• 7,760 points
209 views
0 votes
0 answers

Best place to insert JavaScript within a HTML document

Where should the javascript code go? ...READ MORE

Dec 6, 2022 in Java by Nicholas
• 7,760 points
278 views
0 votes
0 answers

How do I link a JavaScript file to a HTML file?

How should a JavaScript file be linked ...READ MORE

Dec 6, 2022 in Java by Nicholas
• 7,760 points
225 views
0 votes
0 answers

Javascript remove background color and opacity

How can I delete the background-color  ...READ MORE

Dec 6, 2022 in Java by Nicholas
• 7,760 points
1,952 views
0 votes
0 answers

What is 'Currying'?

I've seen references to curried functions in ...READ MORE

Dec 6, 2022 in Java by Nicholas
• 7,760 points
194 views
0 votes
0 answers

How to check if an object is a Promise?

Whether it's an ES6 Promise, a Bluebird ...READ MORE

Dec 6, 2022 in Java by Nicholas
• 7,760 points
255 views
0 votes
0 answers

Javascript counting number of objects in object

I have an object something like: Object {0=Object, ...READ MORE

Nov 17, 2022 in Java by Nicholas
• 7,760 points
477 views
0 votes
0 answers

How to detect #enable-force-dark flag on Chrome v78+ using JavaScript?

I just developed and implemented a dark ...READ MORE

Nov 17, 2022 in Java by Nicholas
• 7,760 points
335 views
0 votes
0 answers

What is the use of the JavaScript 'bind' method?

What is the use of bind() in ...READ MORE

Nov 17, 2022 in Java by Nicholas
• 7,760 points
270 views
0 votes
0 answers

How to remove item from array by value?

Is it possible to delete an item ...READ MORE

Nov 17, 2022 in Java by Nicholas
• 7,760 points
221 views
0 votes
0 answers

Generating Fibonacci Sequence

var x = 0; var y = 1; var ...READ MORE

Nov 17, 2022 in Java by Nicholas
• 7,760 points
387 views
0 votes
0 answers

What is the meaning of "$" sign in JavaScript

A dollar ($) symbol appears in the ...READ MORE

Nov 16, 2022 in Java by Nicholas
• 7,760 points
210 views
0 votes
0 answers

Can you control GIF animation with Javascript?

Is it feasible to use Javascript to ...READ MORE

Nov 16, 2022 in Java by Nicholas
• 7,760 points
573 views
0 votes
0 answers

What is DOM Event delegation?

Can anyone please explain event delegation in ...READ MORE

Nov 16, 2022 in Java by Nicholas
• 7,760 points
237 views
0 votes
0 answers

What is TypeScript and why would I use it in place of JavaScript?

Could you kindly explain the TypeScript language? What ...READ MORE

Nov 16, 2022 in Java by Nicholas
• 7,760 points
254 views
0 votes
0 answers

Why doesn't importing java.util.* include Arrays and Lists?

I am using java on debian 5 java ...READ MORE

Nov 16, 2022 in Java by Ashwini
• 5,430 points
549 views
0 votes
0 answers

Arrays.fill with multidimensional array in Java

Without using a loop, how can I ...READ MORE

Nov 16, 2022 in Java by Ashwini
• 5,430 points
447 views
0 votes
0 answers

What is the difference between contiguous and non-contiguous arrays?

In the numpy manual about the reshape() function, it ...READ MORE

Nov 16, 2022 in Java by Ashwini
• 5,430 points
484 views
0 votes
0 answers

How do JavaScript closures work?

How would you explain JavaScript closures to ...READ MORE

Nov 15, 2022 in Java by Nicholas
• 7,760 points
349 views
0 votes
0 answers

Download File Using JavaScript/jQuery

I have a similar requirement listed here. When ...READ MORE

Nov 15, 2022 in Java by Nicholas
• 7,760 points
317 views
0 votes
0 answers

Javascript counting number of objects in object

I have an object something like: Object {0=Object, ...READ MORE

Nov 15, 2022 in Java by Nicholas
• 7,760 points
431 views
0 votes
0 answers

How to validate password using following conditions?

Password should contain At least one uppercase letter At ...READ MORE

Nov 15, 2022 in Java by Nicholas
• 7,760 points
216 views
0 votes
0 answers

How to create an array containing 1...N

I'm looking for alternatives to the following for creating a JavaScript array with values ranging from 1 to N, where N is only known at  runtime. var foo = []; for (var i = ...READ MORE

Nov 15, 2022 in Java by Nicholas
• 7,760 points
286 views
0 votes
1 answer

Check if a variable is a string in JavaScript

This is what I've found to be ...READ MORE

Nov 15, 2022 in Java by Damonlang
• 1,230 points
291 views
0 votes
1 answer

Calculate string value in javascript, not using eval

You could use the Function() constructor: function evil(fn) ...READ MORE

Nov 15, 2022 in Java by Damonlang
• 1,230 points
2,184 views
0 votes
1 answer

How to draw a circle in HTML5 Canvas using JavaScript?

Here's how to draw a circle in ...READ MORE

Nov 15, 2022 in Java by Damonlang
• 1,230 points
661 views
0 votes
1 answer

Check if input is number or letter javascript

The isNaN function can be used to ...READ MORE

Nov 15, 2022 in Java by Damonlang
• 1,230 points
1,034 views
0 votes
1 answer

Violation Long running JavaScript task took xx ms

These messages are classified as warnings rather ...READ MORE

Nov 15, 2022 in Java by Damonlang
• 1,230 points
3,444 views
0 votes
0 answers

What is "callback hell" and how and why does RX solve it?

Can someone provide a precise description and ...READ MORE

Nov 9, 2022 in Java by Nicholas
• 7,760 points
391 views
0 votes
0 answers

Why were Javascript `atob()` and `btoa()` named like that?

A base64 string and window are both ...READ MORE

Nov 9, 2022 in Java by Nicholas
• 7,760 points
439 views
0 votes
0 answers

What is the difference between ( for... in ) and ( for... of ) statements?

I'm familiar with a for... in loop (it iterates over the keys), but this is the first I've heard of a for... of loop (it iterates over values). I don't understand the for...of loop. var arr = [3, 5, 7]; arr.foo ...READ MORE

Nov 9, 2022 in Java by Nicholas
• 7,760 points
203 views
0 votes
0 answers

How do you use the ? : (conditional) operator in JavaScript?

In simple words, what is the ?: ...READ MORE

Nov 9, 2022 in Java by Nicholas
• 7,760 points
359 views
0 votes
0 answers

How to round to at most 2 decimal places, if necessary

I'd like to round at most two ...READ MORE

Nov 9, 2022 in Java by Nicholas
• 7,760 points
522 views
0 votes
0 answers

What is the "debounce" function in JavaScript?

The JavaScript "debouncing" feature piques my attention. Unfortunately, the code is not presented in a way that I can comprehend.  How does it function (my comments are below)? I just do not understand how this works, to put it briefly. // Returns a function, ...READ MORE

Nov 8, 2022 in Java by Nicholas
• 7,760 points
226 views
0 votes
0 answers

javascript Image tag

I'm adding an image snapshot of a ...READ MORE

Nov 8, 2022 in Java by Nicholas
• 7,760 points
278 views