Is this what you were expecting? If so it is working perfectly fine
007 Cows
016 Chickens
003 Pigs
This is the code I ran, putting your code into an HTML file
<html>
<head>
<title>k</title>
</head>
<body>
<script type="text/javascript">
function zeroPad(number, width) {
let string = String(number);
while (string.length < width){
string = "0" + string;
}
return string;
}
function printFarmInventory(cows, chickens, pigs) {
console.log(`${zeroPad(cows, 3)} Cows`);
console.log(`${zeroPad(chickens, 3)} Chickens`);
console.log(`${zeroPad([pigs], 3)} Pigs`);
}
printFarmInventory(7, 16, 3);
</script>
</body>
</html>
So save this document, and open it up with your browser. You will get a blank page. That is fine.
What you need to do is to right-click and choose Inspect (or ctrl-shift-j) t open up the javascript console.