Try this one tab1 :
<html>
<head>
<script>
// fetch cookie to check
let cookie = document.cookie;
if(cookie.search("Hello=World") >= 0)
{
console.log("Cookie found");
}
else {
document.cookie = "Hello=World";
}
// fetch cookie to print value
cookie = document.cookie;
document.write(cookie);
</script>
</head>
<body>
</body>
</html>
tab 2:
let mobiles = ["Apple", "Samsung", "One Plus", "Moto", "Huwaei"];
// using forEach function
mobiles.forEach(printMobs);
// define the callback function
function printMobs(item,index) {
console.log(`Rank ${index}: ${item} Mobiles`);
}