HTML/JavaScript Web Application Answers

Questions: 680

Answers by our Experts: 648

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Min & Max Values in Array

given an array myArray of integers, write a JS program to find the maximum and minimum values in the array.

input1

[1,4,2,7,9,3,5]

output1

{min: 1, max: 9}


"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++];

}

/* Please do not modify anything above this line */

function findMinAndMaxValuesInArray(arr) {

 /* Write your code here */

}

/* Please do not modify anything below this line */

function main() {

 let myArray = JSON.parse(readLine());

 console.log(findMinAndMaxValuesInArray(myArray));

}



Write a program to print this pattern

Input=4

Output

1357

3571

5731

7531


 The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i


Note:


Return -1 if the array is null

Return 0 if the total amount of food from all houses is not sufficient for all the rats.

Computed values lie within the integer range.

Example:


Input:


r: 7

unit: 2

n: 8

arr: 2 8 3 5 7 4 1 2

Output:


4


Explanation:


Total amount of food required for all rats = r * unit

= 7 * 2 = 14.


The amount of food in the 1st 4 houses = 2+8+3+5 = 18. Since, amount of food in 1st 4 houses is sufficient for all the rats. Thus, output is 4.


take a function to check no is prime or not from array and then is number is prime add 1 to element if not then multiply by 2..note: Use arrow function to add or multiply element part


The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i


Capital and Country

The goal of this coding exam is to quickly get you off the ground with HTML select element

Use the below reference image

https://assets.ccbp.in/frontend/content/dynamic-webapps/capital-and-country-op.gif

Achieve the design with HTML, CSS, and functionality with JS

  • When the capital name is changed in the HTML select element then the text content in the HTML paragraph element should be the country name of the selected capital.

Warning

Do not delete the prefilled code in JS.


Note

HTML option element should consist of selected as an attribute for the value newDelhi by default.


CCBP Login

The goal of this coding exam is to quickly get you off the ground with CCBP Login Page

Use the below reference image

https://assets.ccbp.in/frontend/content/dynamic-webapps/ccbp-login-op.gif


Achieve the given functionality using JS

  • When the HTML input element with the id name lost the focus,
  • If its value is empty, the HTML paragraph element with the id nameErrMsg should have the error message as Required* else should have an empty string.
  • When the HTML input element with the id password lost the focus,
  • If its value is empty, the HTML paragraph element with the id passwordErrMsg should have the error message as Required* else should have an empty string.
  • When the HTML button with attribute type submit is clicked
  • If the value of HTML input elements with ids name and password are not empty then the text content in the HTML paragraph element with id resultMsg should be displayed as Login Success. Otherwise, it should be displayed as Fill in the required details.

Bike Search

The goal of this coding exam is to quickly get you off the ground with HTML search input element and Bootstrap spinner

Use the below reference image.

https://assets.ccbp.in/frontend/content/dynamic-webapps/bike-search-op.gif

Instructions

Add the id searchInput to the HTML input element

  • Add the id searchResults to the HTML container element

Achieve the design with HTML, CSS, and functionality with JS

  • When the page is opened or a value is entered in the HTML input element with id searchInput and press on Enter key
  • Make an HTTP Request (GET method) using Fetch with URL https://apis.ccbp.in/city-bikes?bike_name=
  • The value entered in the HTML input element with id searchInput should be the value for the query parameter of the given URL
  • Add the loading status with the Bootstrap component spinner while making HTTP Request (GET method) as shown in the image.

Random Activity

The goal of this coding exam is to quickly get you off the ground with the DOM Manipulations.

Refer to the below image.

https://assets.ccbp.in/frontend/content/dynamic-webapps/random-activity-output.gif

Achieve the given functionality using JS.

  • Make a HTTP request(GET method) using fetch with the URL
  • https://apis.ccbp.in/random-activity to get a random activity.
  • Add
  • loading status with Bootstrap component spinner while making an HTTP request.

Keyboard Events

The goal of this coding exam is to quickly get you off the ground with Keydown event

Use the below reference image

https://assets.ccbp.in/frontend/content/dynamic-webapps/keyboard-event-op.gif

Achieve the given functionality using JS

  • When the key is entered in the HTML input element with id userInput
  • The value in the HTML span element with id keydownCounter should be Incremented
  • The value in the HTML span element with id keydownCode should contain the key code of the latest key in the input element.




LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS