President Exercise
How do I make an president exercise?
What is a president exercise? How do you make a president exercise? This script and codes were developed by Dovydas on 16 October 2022, Sunday.
President Exercise - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>President Exercise</title>
</head>
<body> <div class="container"> <form class="js-exercise-form"> <input type="text" placeholder="Country" class="js-country" /> <input type="text" placeholder="Year" class="js-year" /> <button type="submit" class="js-button">Submit!</button> </form>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
President Exercise - Script Codes JS Codes
'use strict';
// Exercise
// 1. The president of Lithuania starting from 2009 is Ms. Dalia Grybauskaite.
// 2. Barrack Obama has been the president of the US since 2009.
// 3. Make a program which logs out the name of the president if supplied with the country and the year arguments. If it is not USA or Lithuania or the year is not in the range return "I don’t know".
// 4. Use input boxes for inputing the year and the country
// 5. Use a button for submitting
$('.js-exercise-form').on('submit', function (event) { event.preventDefault(); var country = $('.js-country'); // It is just a link var year = $('.js-year'); // It is just a link // If .. else if .. else // Switch // Hash var result = 'I don\'t know'; if (Number(year.val()) >= 2009) { if (country.val() === 'Lithuania') { result = 'Dalia Grybauskaite'; } else if (country.val() === 'USA') { result = 'Barrack Obama'; } else { // Not Lithuania and not USA // console.log('I don\'t know'); } } else {} // Year is < 2009 // console.log('I don\'t know'); // Clear the fields console.log(result); country.val(''); year.val('');
});
Developer | Dovydas |
Username | tmxyz |
Uploaded | October 16, 2022 |
Rating | 3 |
Size | 2,661 Kb |
Views | 10,120 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Pair website | 1,453 Kb |
Homework | 1,689 Kb |
Project. Part 2 | 1,439 Kb |
Academy Class Demo | 2,024 Kb |
Further Learning | 1,692 Kb |
Background | 1,593 Kb |
JavaScrip Training | 1,985 Kb |
Main | 3,864 Kb |
Firebase | 3,093 Kb |
Media Queries | 1,741 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Email Marketing Mock | Kristenzirkler | 8,224 Kb |
Ipad Mini Showcase | Hornebom | 10,479 Kb |
Starfield old school style | Bolloxim | 5,214 Kb |
About Us | Francescaedits | 1,902 Kb |
Obligatory CSS3 UI Nav | Romandiaz | 9,017 Kb |
404 Page | Saransh | 2,666 Kb |
Client-side Email Validation | Collizo4sky | 1,538 Kb |
Simple Flat Menu | Jeplaa | 2,467 Kb |
Loading animation - freedom purchase | Rocbear | 2,567 Kb |
Fixed Scrolling Nav Bar | Philsinatra | 0 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!