You can’t capture elements from an array like you want.
Either do it the traditional way:
var arr = calcualteMyAge(myDob);
var age = arr[0];
var rang = arr[1];
Or with ES6 you can use destructuring:
const [ age, rang ] = calcualteMyAge(myDob);
4
solved Multiple value returned in JS/How to access an array of returned value from outside the function?