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

Magical Indices

Given an array of integers and a number

Write a JS program to determine the number of valid indices.


Input

  • The first line of input contains an array
  • The second line of input contains a number

Output

  • The output should be a number indicating the number of valid positions

Explanation

For example, an array A = [10, 20, 30] and a value x = 25.

We have values 10, 20, 30 at indices 0,1,2 respectively.

  • Here index 0 is invalid because
  • 10 + 25 = 35 is less than 20 + 30 = 50
  • Here index 1 is valid because
  • 20 + 25 = 45 is greater than 10 + 30 = 40
  • Here index 2 is valid because
  • 30 + 25 = 55 is greater than 10 + 20 = 30

So there are 2 valid indices.

Sample Input 1

[1, 2, 3, 5, 7]

13

Sample Output 1

3

"use strict";

process.stdin.resume();

process.stdin.setEncoding("utf-8");

/////

////

function main() {

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

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

 /* Write your code here and log the output */

}



Product of array Items

given an array integers, write JS program to get the product of the integers in the given array.

input

the input will be containing single line integers.

output

the output should be single line containing the product as shown in sample outputs.


input1

[1,2,3]

output1

[1 * 2 * 3 = 6]

input2

[-1, -2, -3]

output2

[-1*-2*-3 = -6]


"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 integers = JSON.parse(readLine());


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


 /* Write your code here and log the output */

}



squares of Array items

input

  • the input will be a single line containing an array myArray. the myArray consists of numbers and array.

output

  • the output should containig the square of each item.


input1

[[1,2],[3,4],[5,6]]

output1

[ [ 1,4],[9,16],[25,36]]


input2

[12,[24],36,[48,60]]

output2

[144,[576],1296,[2304,3600]]


"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())


 /* Write your code here and log the output */

}



Find the First Value

Given an array myArray of positive integers, write a JS program to find the smallest integer divisible by 2 and 3.

input

the input will be a single line containing an myArray

output

the output should be a single line containing a number divisible by 2 and 3 or undefined.

input1

[51,18,15,12]

output1

12

input2

[41,29,17,19,31]

output2

undefined


"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());

 /* Write your code here and log the output */

}




Replacing Array Item

input

  • the first line of input contains an array myArray
  • the second line of input contains a targetItem
  • the third line of input contains a replaceItem

output

  • the output should be an array containing the replaceItem.

input1

[1,2,3,"four",5,6]

"four"

4

output1

[1,2,3,4,5,6]


input2

[22,44,88,352,352]

352

176

output2

[22,44,88,176,352]


"use strict";


process.stdin.resume();

process.stdin.setEncoding("utf-8");


let inputString = "";

let currentLine = 0;

////

/////

function main() {

 let myArray = JSON.parse(readLine().replace(/'/g, '"'));

 let targetItem = JSON.parse(readLine().replace(/'/g, '"'));

 let replaceItem = JSON.parse(readLine().replace(/'/g, '"'));


  Write your code here and log the output

}

















CCBP Login

Reference image:

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

<!DOCTYPE html>

<html>

<head> </head>

<body>

  <div class="container">

    <h1 class="form-heading">CCBP Login</h1>

    <form id="myForm">

      <div class="username">

        <label for="name" class="username-heading">User Name</label>

        <input autocomplete="off" type="text" id="name" class="input" />

        <p id="nameErrMsg" class="error-message"></p>

      </div>

      <div class="password">

        <label for="password" class="password-heading">Password</label>

        <input type="password" id="password" class="input" />

    



Bike Search

Use the below reference image

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

HTML

<!DOCTYPE html>

<html>


<head></head>

<body>

  Your code goes here

</body>

</html>

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.




1. Add code to the HTML file to reference the script.js file using best practices. Other than this, do not modify either the HTML or CSS file. 2. In the script.js file set strict mode for JavaScript. 3. Create a new h3 element with your name in it and insert it before the first paragraph. 4. In the footer, add a cite element with the text "Information and photos from Wikipedia" where "Wikipedia" is a link to the page "https://en.wikipedia.org/wiki/Bumblebee". 5. console.log the number of paragraphs with some descriptive text (open the browser console to see the output). 6. Add the class "special" to the second h2 element. 7. Select all the figcaptions and make the font italic. (This will require a for loop.) 8. Once complete, use Zip to compress the whole folder (including all files) and submit the zip file.


Use loops and control structure create a program that grades the following list of students given the table grade below

Using multi dimensional arrays, create an array that will store 10 items of stock with brand name. Number of stock in store and Quantity sold

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS