{"id":47782,"date":"2022-03-11T10:00:00","date_gmt":"2022-03-11T16:00:00","guid":{"rendered":"https:\/\/www.codewizardshq.com\/?p=47782"},"modified":"2023-08-04T00:34:26","modified_gmt":"2023-08-04T06:34:26","slug":"javascript-tutorial-easter-egg-hunt","status":"publish","type":"post","link":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/","title":{"rendered":"JavaScript Tutorial: Easter Egg Hunt"},"content":{"rendered":"\n<p>It\u2019s the time of year for candy and eggs, it\u2019s almost Easter! One of our favorite Easter traditions is the egg hunt. Whether you color the eggs, cook them, or go for the plastic variety, it\u2019s so much fun searching for the hidden Easter eggs. Let\u2019s use this real life game to practice coding a game in JavaScript and jQuery.<\/p>\n\n\n<p style=\"background: none repeat scroll 0 0 #ecf3f6; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #011e41; padding: 16px;\"><span>\ud83d\udccc<\/span><small><strong> [Download] JavaScript Projects Source Code<\/strong> Get the full source code for seven JavaScript project examples. <a href=\"#download\">Download Now<\/a><\/small><\/p>\n\n\n\n<p>If you\u2019re a beginner or kid who&#8217;s learning to code, this JavaScript tutorial will show you how to create your own Easter Egg Hunt game using JavaScript and jQuery. You can personalize and hide Easter eggs for your friends and family to find.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-complete-this-easy-javascript-tutorial-to-code-your-own-easter-egg-hunt\"><strong>Complete this easy JavaScript tutorial to code your own Easter egg hunt.<\/strong><\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/margaret.codewizardshq.com\/x_easter_egg_hunt\/i_easter.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Play Easter Egg Hunt<\/a><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/margaret.codewizardshq.com\/x_easter_egg_hunt\/i_easter.html\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"453\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-1024x453.jpg\" alt=\"JavaScript Easter Egg Hunt Complete Game\" class=\"wp-image-47784\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-1024x453.jpg 1024w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-300x133.jpg 300w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-768x340.jpg 768w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-1536x680.jpg 1536w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n<div class=\"lazyblock-cw1-wide-post-container-2stdmm wp-block-lazyblock-cw1-wide-post-container\"><div class=\"wide \"><div class=\"lazyblock-inner-blocks\">\n\n<div class=\"wp-block-atomic-blocks-ab-container table-of-contents ab-block-container\"><div class=\"ab-container-inside\"><div class=\"ab-container-content\">\n<p class=\"title\"><strong>Table of Contents<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#what-you-need\">What you need<\/a><\/li>\n\n\n\n<li><a href=\"#step1\">Step 1: Setup a JavaScript Function<\/a><\/li>\n\n\n\n<li><a href=\"#step2\">Step 2: Add the Function Call<\/a><\/li>\n\n\n\n<li><a href=\"#step3\">Step 3: Fade the Egg on Click<\/a><\/li>\n\n\n\n<li><a href=\"#step4\">Step 4: Add a Score Variable<\/a><\/li>\n\n\n\n<li><a href=\"#step5\">Step 5: Increase the Score By 1<\/a><\/li>\n\n\n\n<li><a href=\"#step6\">Step 6: Update Score with New Score<\/a><\/li>\n\n\n\n<li><a href=\"#step7\">Step 7: Add a Condition For Eggs Found<\/a><\/li>\n\n\n\n<li><a href=\"#step8\">Step 8: Alert When All Eggs Are Found<\/a><\/li>\n\n\n\n<li><a href=\"#step9\">Step 9: Your Game is Complete!<\/a><\/li>\n<\/ul>\n<\/div><\/div><\/div>\n\n<\/div><\/div><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"what-you-need\"><strong>What you need:<\/strong><\/h3>\n\n\n\n<p><strong>1. Text editor<\/strong><\/p>\n\n\n\n<p>In the project examples, we&#8217;ll be using the CodeWizardsHQ editor.<\/p>\n\n\n\n<p>You can use a simple text editor like Notepad, TextEdit, Sublime Text, etc. You may also use an online text editor like Repl.it to write and share your code.<\/p>\n\n\n\n<p><strong>2. Base HTML, CSS, and image files.<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/margaret.codewizardshq.com\/download_x_easter_egg_hunt.zip\" rel=\"nofollow\">Download the base folder<\/a> and open the easter.html file. This folder contains all the images and files you will need to complete your game.&nbsp;<\/p>\n\n\n\n<p>CodeWizardsHQ students, you can download the starter files called \u201cx_easter_egg_hunt\u201d in your editor and easily share your project URL with family and friends. That\u2019s what I\u2019m using for my project!<\/p>\n\n\n\n<p><strong><em>Recommended: <\/em><\/strong><a href=\"https:\/\/www.codewizardshq.com\/html-for-kids\/\"><em>HTML and CSS Coding Classes<\/em><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step1\"><strong>Step 1: Setup a JavaScript Function<\/strong><\/h2>\n\n\n\n<p>The starter files setup the basic HTML and connects your CSS and jQuery. The eggs have been hidden and your goal is to add the JavaScript and jQuery code to collect the eggs and win the game.<\/p>\n\n\n\n<p>Open the <strong>easter.html<\/strong> file and find the &lt;script&gt; tag. Inside the &lt;script&gt; tag, set up a function called foundEgg().<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>function foundEgg(event) { <\/code><\/p>\n\n\n\n<p><code>}<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"112\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step1-1.jpg\" alt=\"Easter JavaScript Tutorial Step 1\" class=\"wp-image-47804\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step1-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step1-1-300x75.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step2\"><strong>Step 2: Add the function call<\/strong><\/h2>\n\n\n\n<p>We want to call our foundEgg() function for all elements with class .egg.<\/p>\n\n\n\n<p>Use a \u201cclick\u201d function to call the foundEgg() function. When an egg is clicked, the foundEgg() function will run.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>$('.egg').click(foundEgg);<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"139\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step2-1.jpg\" alt=\"Easter JavaScript Tutorial Step 2\" class=\"wp-image-47810\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step2-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step2-1-300x93.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Tip: Make sure your function call happens after your function definition and not inside.<\/p>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step3\"><strong>Step 3: Fade the Egg on Click<\/strong><\/h2>\n\n\n\n<p>Create a variable called \u201cegg\u201d that is equal to the current target for the event. The \u201cclick\u201d is the mouse event and the current target is the egg.<\/p>\n\n\n\n<p>Then apply the jQuery fadeOut() function to the targeted element. In the fadeOut() function, add a parameter for the duration, or how long it takes to fade out, in milliseconds. When the egg is clicked it will now fade from view over 250 milliseconds.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>var egg = $(event.currentTarget);<\/code><\/p>\n\n\n\n<p><code>egg.fadeOut(250);<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"187\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step3-1.jpg\" alt=\"Easter JavaScript Tutorial Step 3\" class=\"wp-image-47811\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step3-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step3-1-300x125.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Tip: You can select the current mouse or keyboard event with the event variable. Using the event variable is the same as accessing window.event.<\/p>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step4\"><strong>Step 4: Add a Score Variable<\/strong><\/h2>\n\n\n\n<p>To keep track of how many eggs have been discovered, let\u2019s add a score.&nbsp;<\/p>\n\n\n\n<p>There is already a score element in your HTML where we can display the score. In the JavaScript, we need a variable to represent our score as it changes. Define the variable \u201cscore\u201d before your foundEgg() function.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>var score = 0;<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"220\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step4-1.jpg\" alt=\"Easter JavaScript Tutorial Step 4\" class=\"wp-image-47812\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step4-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step4-1-300x147.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step5\"><strong>Step 5: Increase the Score By 1<\/strong><\/h2>\n\n\n\n<p>Every time we click an egg, we want the score to increase by one. Increase the score variable by one inside of the foundEgg() function.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>score = score + 1;<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"250\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step5-1.jpg\" alt=\"Easter JavaScript Tutorial Step 5\" class=\"wp-image-47813\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step5-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step5-1-300x167.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Tip: You can also increment by one using the ++ notation. In that case, you would write score = score++;<\/p>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step6\"><strong>Step 6: Update Score with New Score<\/strong><\/h2>\n\n\n\n<p>Now, we need to update the score on the screen. The variable has increased, but we need to display the new score.&nbsp;<\/p>\n\n\n\n<p>Select the div with id \u201cscore\u201d and update the text with the score variable using the text() function.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>$(\u201c#score\u201d).text(score);<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"273\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step6-1.jpg\" alt=\"Easter JavaScript Tutorial Step 6\" class=\"wp-image-47806\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step6-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step6-1-300x182.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p><strong><em>Recommended: <\/em><\/strong><a href=\"https:\/\/www.codewizardshq.com\/javascript-for-kids\/\"><em>JavaScript Coding for Kids<\/em><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step7\"><strong>Step 7: Add a Condition For Eggs Found<\/strong><\/h2>\n\n\n\n<p>Using an if statement, we can set an alert when all of the eggs have been found. Since we have four eggs, we will use the condition if score &gt;=4.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p>&nbsp;&nbsp;&nbsp;<code>if(score &gt;= 4){<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;<code>}<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"355\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step7-1.jpg\" alt=\"Easter JavaScript Tutorial Step 7\" class=\"wp-image-47807\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step7-1.jpg 450w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step7-1-300x237.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step8\"><strong>Step 8: Alert When All Eggs Are Found<\/strong><\/h2>\n\n\n\n<p>Inside of the if statement, we will execute an alert that says \u201cYou found all of the eggs!\u201d. When the player finds four or more eggs, they will see this alert.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><code>alert('You found all of the eggs!');<\/code><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"381\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step8-1.jpg\" alt=\"Easter JavaScript Tutorial Step 8\" class=\"wp-image-47808\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step8-1.jpg 490w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/js-easter-game-step8-1-300x233.jpg 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Tip: Make sure your alert is inside of the if statement {}.<\/p>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 9: Your game is complete!<\/strong><\/h2>\n\n\n\n<p>Nice work! You\u2019ve completed this simple JavaScript tutorial. Open the i_easter.html file to see the completed game code.&nbsp;<\/p>\n\n\n\n<p>Next, get creative and design your own theme or add additional hidden eggs with the bonus images.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/margaret.codewizardshq.com\/x_easter_egg_hunt\/i_easter.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/margaret.codewizardshq.com\/x_easter_egg_hunt\/i_easter.html<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/margaret.codewizardshq.com\/x_easter_egg_hunt\/i_easter.html\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"453\" src=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-1024x453.jpg\" alt=\"JavaScript Easter Egg Hunt Complete Game\" class=\"wp-image-47784\" srcset=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-1024x453.jpg 1024w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-300x133.jpg 300w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-768x340.jpg 768w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete-1536x680.jpg 1536w, https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/easter_complete.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><strong><em>Recommended: <\/em><\/strong><a href=\"https:\/\/www.codewizardshq.com\/coding-websites-for-kids\/\"><em>Kids Coding Websites<\/em><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"download\"><strong>Download JavaScript Projects Source Code<\/strong><\/h2>\n\n\n\n<p>If you want to get the code behind 7 different JavaScript projects, download the full source code for free. You can use this code as an example to add to or inspire new projects. Enter your email below:<\/p>\n\n\n\n\n\n\n<div style=\"height:70px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Learn JavaScript with Live Coding Classes&nbsp;<\/strong><\/h2>\n\n\n\n<p>If you want to build more games in JavaScript, check out our <a href=\"https:\/\/www.codewizardshq.com\/coding-programs-for-kids\/\">coding programs for kids<\/a> ages 8-18. We teach <a href=\"https:\/\/www.codewizardshq.com\/javascript-classes-for-kids\/\">coding classes in JavaScript<\/a> where students can learn to build interactive applications and websites. You will go from a JavaScript beginner to learning advanced JavaScript code with the most fun and effective coding classes for kids.&nbsp;<\/p>\n\n\n\n<p><strong>Ready to level up your child\u2019s learning experience?<\/strong> Take a coding class with CodeWizardsHQ:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.codewizardshq.com\/coding-classes-elementary-school-students\/\">Elementary School Coding Classes<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.codewizardshq.com\/coding-classes-middle-school-students\/\">Middle School Coding Classes<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.codewizardshq.com\/coding-classes-high-school-students\/\">High School Coding Classes<\/a><\/li>\n<\/ul>\n\n\n\n<p>Happy Easter!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s the time of year for candy and eggs, it\u2019s almost Easter! One of our favorite Easter traditions is the egg hunt. Whether you color the eggs, cook them, or go for the plastic variety, it\u2019s so much fun searching for the hidden Easter eggs. Let\u2019s use this real life game to practice coding a [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":47803,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"inline_featured_image":false,"_lmt_disableupdate":"yes","_lmt_disable":"","footnotes":""},"categories":[10809,4758],"tags":[10815,10739,10814],"class_list":["post-47782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-activities","category-learn-coding","tag-free-activities","tag-javascript","tag-tutorials"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v26.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript Tutorial for Kids &amp; Beginners: Easter Egg Hunt<\/title>\n<meta name=\"description\" content=\"Complete this easy JavaScript tutorial to code your own Easter egg hunt. Fun for kids and beginners to practice JavaScript and jQuery coding.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Tutorial: Easter Egg Hunt\" \/>\n<meta property=\"og:description\" content=\"Complete this easy JavaScript tutorial to code your own Easter egg hunt. Fun for kids and beginners to practice JavaScript and jQuery coding.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeWizardsHQ\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codewizardshq\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-11T16:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-04T06:34:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Social-Banner.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"323\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Margaret Choi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codewizardshq\" \/>\n<meta name=\"twitter:site\" content=\"@codewizardshq\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Margaret Choi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\/\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"Article\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Margaret Choi\",\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/person\/0d1794273fcc4d0b634d50375e00e1ca\"\n\t            },\n\t            \"headline\": \"JavaScript Tutorial: Easter Egg Hunt\",\n\t            \"datePublished\": \"2022-03-11T16:00:00+00:00\",\n\t            \"dateModified\": \"2023-08-04T06:34:26+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\"\n\t            },\n\t            \"wordCount\": 993,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg\",\n\t            \"keywords\": [\n\t                \"free activities\",\n\t                \"JavaScript\",\n\t                \"tutorials\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Activities\",\n\t                \"Learn Coding\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\",\n\t            \"name\": \"JavaScript Tutorial for Kids & Beginners: Easter Egg Hunt\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg\",\n\t            \"datePublished\": \"2022-03-11T16:00:00+00:00\",\n\t            \"dateModified\": \"2023-08-04T06:34:26+00:00\",\n\t            \"description\": \"Complete this easy JavaScript tutorial to code your own Easter egg hunt. Fun for kids and beginners to practice JavaScript and jQuery coding.\",\n\t            \"breadcrumb\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#breadcrumb\"\n\t            },\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg\",\n\t            \"contentUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg\",\n\t            \"width\": 1600,\n\t            \"height\": 395,\n\t            \"caption\": \"JavaScript Easter Game Banner\"\n\t        },\n\t        {\n\t            \"@type\": \"BreadcrumbList\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#breadcrumb\",\n\t            \"itemListElement\": [\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 1,\n\t                    \"name\": \"Home\",\n\t                    \"item\": \"https:\/\/www.codewizardshq.com\/\"\n\t                },\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 2,\n\t                    \"name\": \"JavaScript Tutorial: Easter Egg Hunt\"\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/#website\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/\",\n\t            \"name\": \"CodeWizardsHQ\",\n\t            \"description\": \"The leading online coding academy for kids and teens ages 8-18\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\/\/www.codewizardshq.com\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/#organization\",\n\t            \"name\": \"CodeWizardsHQ\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/\",\n\t                \"url\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png\",\n\t                \"contentUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png\",\n\t                \"width\": 150,\n\t                \"height\": 108,\n\t                \"caption\": \"CodeWizardsHQ\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/\"\n\t            },\n\t            \"sameAs\": [\n\t                \"https:\/\/www.facebook.com\/codewizardshq\/\",\n\t                \"https:\/\/x.com\/codewizardshq\",\n\t                \"https:\/\/www.instagram.com\/codewizardshq\/\",\n\t                \"https:\/\/www.linkedin.com\/company\/codewizardshq\",\n\t                \"https:\/\/www.pinterest.com\/codewizardshq\/\",\n\t                \"https:\/\/www.youtube.com\/channel\/UC4NM0jfN0LI8_vWtiwLqgGw\"\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/person\/0d1794273fcc4d0b634d50375e00e1ca\",\n\t            \"name\": \"Margaret Choi\",\n\t            \"image\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/person\/image\/\",\n\t                \"url\": \"https:\/\/secure.gravatar.com\/avatar\/7815305d40218c8baa3db95a35d697293aad7b383484ae7e26b6383e0f67b6ba?s=96&d=mm&r=g\",\n\t                \"contentUrl\": \"https:\/\/secure.gravatar.com\/avatar\/7815305d40218c8baa3db95a35d697293aad7b383484ae7e26b6383e0f67b6ba?s=96&d=mm&r=g\",\n\t                \"caption\": \"Margaret Choi\"\n\t            },\n\t            \"description\": \"Instructor and marketing manager at CodeWizardsHQ since 2019. She breaks down topics around coding and specific coding languages for kids to understand.\",\n\t            \"sameAs\": [\n\t                \"https:\/\/www.facebook.com\/margaret.choi.3\"\n\t            ],\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/author\/margaretchoi\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript Tutorial for Kids & Beginners: Easter Egg Hunt","description":"Complete this easy JavaScript tutorial to code your own Easter egg hunt. Fun for kids and beginners to practice JavaScript and jQuery coding.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Tutorial: Easter Egg Hunt","og_description":"Complete this easy JavaScript tutorial to code your own Easter egg hunt. Fun for kids and beginners to practice JavaScript and jQuery coding.","og_url":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/","og_site_name":"CodeWizardsHQ","article_publisher":"https:\/\/www.facebook.com\/codewizardshq\/","article_published_time":"2022-03-11T16:00:00+00:00","article_modified_time":"2023-08-04T06:34:26+00:00","og_image":[{"width":600,"height":323,"url":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Social-Banner.jpg","type":"image\/jpeg"}],"author":"Margaret Choi","twitter_card":"summary_large_image","twitter_creator":"@codewizardshq","twitter_site":"@codewizardshq","twitter_misc":{"Written by":"Margaret Choi","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#article","isPartOf":{"@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/"},"author":{"name":"Margaret Choi","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/person\/0d1794273fcc4d0b634d50375e00e1ca"},"headline":"JavaScript Tutorial: Easter Egg Hunt","datePublished":"2022-03-11T16:00:00+00:00","dateModified":"2023-08-04T06:34:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/"},"wordCount":993,"publisher":{"@id":"https:\/\/www.codewizardshq.com\/#organization"},"image":{"@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg","keywords":["free activities","JavaScript","tutorials"],"articleSection":["Activities","Learn Coding"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/","url":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/","name":"JavaScript Tutorial for Kids & Beginners: Easter Egg Hunt","isPartOf":{"@id":"https:\/\/www.codewizardshq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage"},"image":{"@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg","datePublished":"2022-03-11T16:00:00+00:00","dateModified":"2023-08-04T06:34:26+00:00","description":"Complete this easy JavaScript tutorial to code your own Easter egg hunt. Fun for kids and beginners to practice JavaScript and jQuery coding.","breadcrumb":{"@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#primaryimage","url":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg","contentUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner.jpg","width":1600,"height":395,"caption":"JavaScript Easter Game Banner"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codewizardshq.com\/javascript-tutorial-easter-egg-hunt\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codewizardshq.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript Tutorial: Easter Egg Hunt"}]},{"@type":"WebSite","@id":"https:\/\/www.codewizardshq.com\/#website","url":"https:\/\/www.codewizardshq.com\/","name":"CodeWizardsHQ","description":"The leading online coding academy for kids and teens ages 8-18","publisher":{"@id":"https:\/\/www.codewizardshq.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codewizardshq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codewizardshq.com\/#organization","name":"CodeWizardsHQ","url":"https:\/\/www.codewizardshq.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png","contentUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png","width":150,"height":108,"caption":"CodeWizardsHQ"},"image":{"@id":"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codewizardshq\/","https:\/\/x.com\/codewizardshq","https:\/\/www.instagram.com\/codewizardshq\/","https:\/\/www.linkedin.com\/company\/codewizardshq","https:\/\/www.pinterest.com\/codewizardshq\/","https:\/\/www.youtube.com\/channel\/UC4NM0jfN0LI8_vWtiwLqgGw"]},{"@type":"Person","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/person\/0d1794273fcc4d0b634d50375e00e1ca","name":"Margaret Choi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7815305d40218c8baa3db95a35d697293aad7b383484ae7e26b6383e0f67b6ba?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7815305d40218c8baa3db95a35d697293aad7b383484ae7e26b6383e0f67b6ba?s=96&d=mm&r=g","caption":"Margaret Choi"},"description":"Instructor and marketing manager at CodeWizardsHQ since 2019. She breaks down topics around coding and specific coding languages for kids to understand.","sameAs":["https:\/\/www.facebook.com\/margaret.choi.3"],"url":"https:\/\/www.codewizardshq.com\/author\/margaretchoi\/"}]}},"modified_by":"Dima","featured_image_src":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner-600x395.jpg","featured_image_src_square":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/03\/JavaScript-Easter-Game-Banner-600x395.jpg","author_info":{"display_name":"Margaret Choi","author_link":"https:\/\/www.codewizardshq.com\/author\/margaretchoi\/"},"_links":{"self":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts\/47782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/comments?post=47782"}],"version-history":[{"count":2,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts\/47782\/revisions"}],"predecessor-version":[{"id":71698,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts\/47782\/revisions\/71698"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/media\/47803"}],"wp:attachment":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/media?parent=47782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/categories?post=47782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/tags?post=47782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}