How much would I weigh on…?

I have a morbid interest in how much I would weigh on various celestial bodies. This isn’t for everyone, but visualization of weight helps me quantify extrasolar worlds and weirdos like neutron stars. I played around with a spreadsheet yesterday to start off. I came up with a couple of functions to calculate equatorial surface gravity, to parse strings like `1.2345 x 10^30` into a valid JavaScript exponential number, and then I populated the spreadsheet with sample data from Wikipedia.

I want to first expand the spreadsheet to a few hundred objects (extrasolar planets and stars), and maybe add temperature and pressure data. How dead would I be on Planet X? Could I touch Star Y and survive (you could probably fly inside NML Cygni and survive to tell the tale)? I know I’ll be kill if I land on Planet Z, but just how dead will I be? In how many ways?

Then I want to take this sheet, export it to JSON and turn it into an interactive website built with Angular. One visualization I have in my mind is the Apollo 15 hammer drop, but from different heights based around orders of 10: 1 metres, 10 metres, 100 metres, …, 1000 kilometres, and so on.

``````function STRING_TO_POWER(str) {
if (typeof str === 'number') {
return str;
}

var multiple = str.replace(/(?![.,]|\d).*/, '');
var base = str.replace(/(.*?(\s|[Xx]|\*|\()(?=\d{2})|\^.*)/g, '');
var power = str.replace(/(^.*\^(?=(-)?\d{1,3})|\))/g, '');

return multiple * Math.pow(base, power);
}

mass = STRING_TO_POWER(mass);