In Java function have "long" variable.
public class LongToIntExample1{
public static void main(String args[]){
long l=2672558412L;
int i=(int)l;
System.out.println(i);
}
}
=> Output: -1622408884
I tried with NodeJS function as below but wrong output:
module.exports.LongToIntExample1 = () => {
var l = 2672558412n;
var i = parseInt(l);
console.log(i);
}
=> Output: 2672558412
How to write NodeJS function as Java function with same output?