var obj = {
" employee name": "Sumit Vishwakarma",
"employee id ": 001,
"email ": "abc@gmail.com",
"mobile no": 9999999999,
};
Object.keys(obj).forEach((key) => {
var replacedKey = key.trim().toUpperCase().replace(/ss+/g, "_");
if (key !== replacedKey) {
obj[replacedKey] = obj[key];
delete obj[key];
}
});
console.log(obj);
result
EMAIL: "abc@gmail.com",
EMPLOYEE ID: 1,
EMPLOYEE_NAME: "Sumit Vishwakarma",
MOBILE_NO: 9999999999
}