Skip to content

Tag: javascript

How to test es6 default values in jest

How do you test the given default parameter value in jest? An example having the module: Or abit more complicated function module. Answer Each expected result of the test case is specified by us, that is, we have set the expected result in advance, whether the result actually returned by the test code is cons…

How can I get a random streetview location?

I am trying to write a JavaScript web application that allows me to get a random location that has Google Street-view information. The first step I took was to create a random latitude and longitude location, however as the Earth is mostly ocean, I ended up there more often than not. I then tried to use the c…

find sum of multiples 3 and 5, JS

I’m given a number and I need to find the sum of the multiples of 3 and 5 below the number. For example: 20 => 78 = 3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 My code works, but not for numbers greater than 1,000,000 (I tested it for 100,000 – it gives