I tried both :
var a = new BigInteger(5);
And
var b = new BigInteger(5, 10);
But both give me the error:
TypeError: 'undefined' is not an object (evaluating 'b.nextBytes')
bnpFromNumberjsbn2.js:126
Can you only instantiate with strings?
I'd wanted to give a better answer, but you didn't mention WHICH BigInteger library you were using.
now, with this knowledge you can override BigInteger