How to loop through JSON Object using JQuery

Sometimes you get into a need where you need to loop through a JSON object while using JQuery or Angular 6 (with typescript). This is become very useful when you are not fully aware of what is the JSON object has in term of properties but you still needs to do some operations on the object properties..
So Let’s assume that you have a JSON Object called employee and you need to print the keys and values of these keys:

var employee = {
firstName: "FName",
lastName: "LName"
}

var keys = Object.keys(employee);

for (var i = 0; i < keys.length; i++) {
    console.log(keys[i]]); /*printing the key, so it will be firstName and lastName */
   console.log(employee[keys[i]]); /*printing the values; which will be FName and LName */
}

Note: This syntax is working fine with Angular 6 while using Type Script and with JQuery.