Skip to content

Instantly share code, notes, and snippets.

@nerdpruitt
Last active December 14, 2015 16:38
Show Gist options
  • Save nerdpruitt/5116455 to your computer and use it in GitHub Desktop.
Save nerdpruitt/5116455 to your computer and use it in GitHub Desktop.
function logCar(obj, objName) {
var result = "";
// Object.keys(obj).length
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
result += obj[i] + " ";
}
}
console.log("My car is a " + result);
}
logCar({ color: 'blue', make: 'BMW' });
logCar({ color: 'red', make: 'Ferrari'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment