President Exercise

Developer
Size
2,661 Kb
Views
10,120

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 Previews

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('');
});
President Exercise - Script Codes
President Exercise - Script Codes
Home Page Home
Developer Dovydas
Username tmxyz
Uploaded October 16, 2022
Rating 3
Size 2,661 Kb
Views 10,120
Do you need developer help for President Exercise?

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!

Dovydas (tmxyz) Script Codes
Create amazing love letters with AI!

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!