Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

What to do level 11 lesson 7

<html>
<head>
<script>
// fetch cookie to check
let cookie ="path=/";
if(cookie.search("Hello=World"))
{
console.log("Cookie found");
}
else {
document.cookie = "Hello=World";
}
// fetch cookie to print value
cookie = document.cookie;
if(cookie == "Hello-World"){
console.log("Hello=World");
}
document.write(cookie);
</script>
</head>
<body>

</body>
</html>
by

1 Answer

kshitijrana14
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`);
}

Login / Signup to Answer the Question.