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

SERIES OF OPERATIONS

myArray of numbers, write a JS program to perform the following steps and log the result.

Multiply each value with 9.

Subtract 20 from each value.

Multiply each value with 7.

Log the values of the resulting array separated by a space.

Input

The input will be a single line containing an array myArray

Output

The output should be a single line with values separated by a space

Constraints

Each value in the array must be a number

Sample Input

[ 12, 2, 2, 4, 1 ]

Sample Output

616 -14 -14 112 -77

"use strict";

process.stdin.resume();

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

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

  /* Write your code here */

}


Lucky Pairs

Write Java script program to count the number of lucky pairs.

Two numbers are said to be lucky pairs . if first number is divided by second number and second number is divided by first number. given an integer N . find all possible combinations of lucky pairs.



input:

2


output:

2


Explanation:

input is 2

possible combinations are [1,2],[2,1].here in [1,2]1 is divisible by 2, and in [2,1] 2 is divisible by 1 .so the number of lucky pairs are 2.



Prepare coding for the above using Flutter for an Android App.


Given an array

myArray of numbers, write a JS program to perform the following steps and log the result.

Multiply each value with 9.

Subtract 20 from each value.

Multiply each value with 7.

Log the values of the resulting array separated by a space.

Input

The input will be a single line containing an array myArray

Output

The output should be a single line with values separated by a space

Constraints

Each value in the array must be a number

Sample Input

[ 12, 2, 2, 4, 1 ]

Sample Output

616 -14 -14 112 -77

"use strict";

process.stdin.resume();

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

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

  /* Write your code here */

}


Given two boolean values

isGrassTrimmerFound and isWaterHosePipeFound as inputs, create three JS promises using async/await and try/catch blocks.

Input

The first line of input contains a boolean isGrassTrimmerFound

The second line of input contains a boolean isWaterHosePipeFound

Sample Input 1

true

true

Sample Output 1

Grass Trimmed

Garden Cleaned

Watered Plants

Sample Input 2

true

false

Sample Output 2

Grass Trimmed

Garden Cleaned

Water Hose Pipe Not Found


"use strict";

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

function main() {

 const isGrassTrimmerFound = JSON.parse(readLine());

 const isWaterHosePipeFound = JSON.parse(readLine());


 /* Write code */

 const myPromise = async () => {

  try {  

   /* Write code */

  } catch(error) {

   /* Write code */    

  }

 };  

 myPromise();

}



"use strict";



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 */


class Submarine {

 constructor() {

  this.isSubmerged = false;

 }


 /* Write your code here */

}


class WeaponUnit extends Submarine {

  

 /* Write your code here */


}


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


function main() {

 const totalTorpedos = parseInt(readLine());

 const torpedosFired = parseInt(readLine());  

  

 const weaponUnit1 = new WeaponUnit(totalTorpedos, torpedosFired);

  

 weaponUnit1.dive();

 weaponUnit1.fireTorpedos();

 weaponUnit1.surface();

}


Using www.bbc.com website,

discuss how the below languages could be used in the site with 2 examples.

1.HTML

2.CSS

3.JavaScript

4.JSON


Series of OperationsInput

  • The input will be a single line containing an array myArray

Output

  • The output should be a single line with values separated by a space

Constraints

  • Each value in the array must be a number

Sample Input

[ 12, 2, 2, 4, 1 ]

Sample Output

616 -14 -14 112 -77


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

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


 /* Write your code here */

}



Sample Input 1

[ 1, 2, 3, 4, 5 ]

Sample Output 1

[ 1, 2, 9, 4, 25 ]

Sample Input 2

[ 2, 4 ]

Sample Output 2

[ 4, 4 ]

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

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

  

 /* Write your code here */

}


Unite Family


Sample Input

{'surname' : 'Jones', 'city': 'Los Angeles'}

{'dish': 'puddings'}

{'pet': 'Peter'}


Sample Output

Mr and Mrs Jones went to a picnic in Los Angeles with a boy and a pet Peter. Mrs Jones made a special dish "puddings"


"use strict";


 return inputString[currentLine++];

}


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


function main() {

 const father = JSON.parse(readLine().replace(/'/g, '"'));

 const mother = JSON.parse(readLine().replace(/'/g, '"'));

 const child = JSON.parse(readLine().replace(/'/g, '"'));

 

 /* Write your code here */ 


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

 console.log(`Mr and Mrs ${family.surname} went to a picnic in ${family.city} with a boy and a pet ${family.pet}. Mrs ${family.surname} made a special dish "${family.dish}"`);

}


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS