Skip to content
Advertisement

Tag: integer

Concatinate different type arrays

suppose, array1 = [‘B’, ‘G’, ‘R’, ‘A’], array2 is Uint8Array, how to concatinate these two arrays ? I used var array3 = array1.concat(array2), but the result seems wrong , and array3.length is alwalys 5, regardless of content of array2. Answer You can do:

Hackerrank Compare the Triplets Javascript

I’m aware that there is already a thread on this topic, however I’m just wondering why this solution isn’t working for HackerRank’s “Compare the Triplets” problem? I’m only getting an output of 1 when it should be 1 1. The problem states that if a0 > b0, a1 > b1, or a2 > b2 (and vice versa), the result should

Is there or isn’t there an integer type in JavaScript?

I am just starting to learn Javascript and I immediately got confused by seemingly contradictory statements in Mozilla’s A re-introduction to JavaScript (JS tutorial). One one hand: “There’s no such thing as an integer in JavaScript, so you have to be a little careful with your arithmetic if you’re used to math in C or Java.” On the other hand

JavaScript Integer math incorrect results

I am just trying to implement a simple RNG in JS. What’s happening is javascript evaluates 119106029 * 1103515245 to be 131435318772912110 rather than 131435318772912105. We know it’s wrong since two odd numbers multiplied does not give an even number. Anyone know what’s up? I just want a reliable repeatable RNG, and because of these incorrect values I can’t get

Advertisement