Remove Item in Local Storage
The goal of this coding exam is to quickly get you off the ground with
Remove Item In Localstorge
Use the below reference image
https://assets.ccbp.in/frontend/content/dynamic-webapps/removeItem-in-localStorage-op.gif
HTML
<!DOCTYPE html>
<html>
<head></head>
<body>
<div class="display-username text-center">
<p>Hello, <span id="name">Varun</span>!</p>
<p>Update your Name</p>
<input id="inputValue" placeholder="Write your name here" />
<br />
<button class="btn-primary save-button" id="saveBtn">
Save to Local Storage
</button>
<button class="btn-secondary reset-button" id="resetBtn">Reset</button>
</div>
</body>
</html>
Find the Duplicate in the array
Given an myArray write a JS program to find duplicate in the Array.
input1
[1,2,3,4,5,7,7,8]
output1
7
input1
{'light'', "dark", "twinlight"]
output2
false
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString
.trim()
.split("\n")
.map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
let myArray = JSON.parse(readLine().replace(/'/g, '"'));
/* Please do not modify anything above this line */
/* Write your code here */
}
Find the Duplicate in the array
Given an myArray write a JS program to find duplicate in the Array.
input1
[1,2,3,4,5,7,7,8]
output1
7
output1
{'light'', "dark", "twinlight"]
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString
.trim()
.split("\n")
.map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
let myArray = JSON.parse(readLine().replace(/'/g, '"'));
/* Please do not modify anything above this line */
/* Write your code here */
}
Hourly Stop Watch
The goal of this coding exam is to quickly get you off the ground with the clearInterval and setInterval.
Refer to the below image.
https://assets.ccbp.in/frontend/content/react-js/hourly-stop-watch-op.gif
Achieve the given functionality using JS.
The timer should be initiated at 0.
Note
This is a one hour timer. The maximum time is one hour.
an h1 element containing "Assignment 4"
an h2 element containing the name of your favourite sport or hobby
a p element with a description of the sport or hobby you chose (just a sentence or two)
2. Create a JavaScript file named script.js. Associate this file with your HTML file using the best
practices taught in class.
3. In the JavaScript file do the following:
create a variable that contains your name
console.log the value of this variable
include the following code in your JavaScript file. Don't worry about how it works for now,
we will cover this in the next module, but it will replace the text in the h2 element when
viewing the webpage. (Use the variable name that you created instead of myName.)
document.querySelector('h2').textContent = myName;
4. Open your HTML file in a web browser. Check the console for you output and the web page for
the replacement text on the page.
Javascript excercise: Create a new html file. Give provision for users to insert a number (you can use prompt boxes or text fields). If the user inserts a number, show the multiplication table for that number in console log. But, if the user inserts anything other than a number, show appropriate error messages.
Continuation of assignment from Lab 5: When all the mandatory form details (name and email) are enterd correctly to the form created in lab 5, the form is considered valid. When user clicks on submit button, show a preview of the entire form data in an alert window. (hint: refer to examples done in class)
Use Localstorage using textarea:
Use the below reference image link:.
https://res.cloudinary.com/dfxicv9iv/image/upload/v1618940947/localstorage-textarea_yvgdzf.gif
Achieve the design with HTML, CSS, and functionality with JS.
Quick Tip
Use bootstrap button primary.
DOM Manipulations
Use the below reference image link:.
https://res.cloudinary.com/dfxicv9iv/image/upload/v1619260598/dynamic-dom-manipulations-3_bov0vg.gif
When the Delete button is clicked
Note
Use the removeChild method to remove the element from DOM.
DOM Manipulations
Use the below reference image link:.
https://res.cloudinary.com/dfxicv9iv/image/upload/v1619259911/dom-manipulations-2_ax38mg.gif
Dynamically add the elements in HTML container element with id
myContainer to achieve the design.
Note
Use the checked property and classList.toggle method to achieve the functionality.
CSS Colors used:
#7a0ecc
#f2ebfe