HTML/JavaScript Web Application Answers

Questions: 588

Answers by our Experts: 588

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

Make a website using HTML and CSS all about Zombies


given myArray of numbers, write a function to square the alternate numbers of the myArray, starting from index 0 using the array method map.Input

  • input will be a single line containing  myArray

Output

  • output should be a single line containing an array with alternate numbers squared

Constraints

  • Each value in the array must be a number

1 Input

[ 1, 2, 3, 4, 5 ]

1 Output

[ 1, 2, 9, 4, 25 ]

2 Input

[ 2, 4 ]

2 Output

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

}

/*not modify above this line */

function main() {

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

 /* Write your code here */


Array of String to UpperCase

myArray of strings as an input, write a JS program to convert all the strings in myArray to uppercase.Input

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

Output

  • The output should be a single line containing an array of strings in uppercase

Sample Input 1

[ 'book', 'table', 'strawberries', 'lemons' ]

Sample Output 1

[ 'BOOK', 'TABLE', 'STRAWBERRIES', 'LEMONS' ]

Sample Input 2

[ 'my best friend', 'florida', 'winter' ]

Sample Output 2

[ 'MY BEST FRIEND', 'FLORIDA', 'WINTER' ]


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

}

/* not modify anything above this line */


String Slicing
Given two strings 
inputString and subString as inputs, write a JS program to slice the inputString if it includes the subString. Slice the inputString starting from the subString to the end of the inputString.Input
The first line of input contains a string inputString
The second line of input contains a string subString
Output
The output should be a sliced string or inputString (if the inputString does not include the subString)
Sample Input 1
JavaScript
S
Sample Output 1
Script
Sample Input 2
Language
air
Sample Output 2
Language
"use strict";
function readLine() {
 return inputString[currentLine++];
}
function main() {
 let inputString = readLine();
 const subString = readLine();
 /* Write your code here */ 
 console.log(subString.substr(inputString.substr(subString)));
}

Fare per Kilometer

Given total fare

fare and distance travelled in kilometers distance for a rental bike, write a JS constructor function with a method to calculate the fare per kilometer.

Quick Tip

The formula to calculate the fare per kilometer is,

fare per kilometer = fare / distance

Input

The first line of input contains a number

fare The second line of input contains a number distanceOutput

The output should be a single line containing the fare per kilometer


Update Pickup Point

Given a previous pickup point in the prefilled code, and updated pickup point

area, city as inputs, write a JS factory function with a method to update the pickup point.Input

  • The first line of input contains a string area
  • The second line of input contains a string city

Output

  • The output should be a single line containing the updated pickup point area and city separated by a space

Update Pickup Point

Given a previous pickup point in the prefilled code, and updated pickup point

area, city as inputs, write a JS factory function with a method to update the pickup point.Input

  • The first line of input contains a string area
  • The second line of input contains a string city

Output

  • The output should be a single line containing the updated pickup point area and city separated by a space

Submarine

Given two numbers

totalTorpedos, torpedosFired as inputs, write a super class Submarine with property and methods as below,PropertyDescriptionisSubmergedIt should contain a boolean value to indicate whether the submarine is submerged or not.....

The sequence of operations is,

  1. Submerge the Submarine
  2. Fire torpedos
  3. Surface the Submarine

Input

  • The first line of input contains a number totalTorpedos
  • The second line of input contains a number torpedosFired

Output

  • The first line of output is a string with Submarine Submerged text
  • The second line of output is a string with the number of torpedos fired and left, as shown in sample outputs
  • The third line of output is a string with Submarine Surfaced text

Sample Input 1

5

2

Sample Output 1

Submarine Submerged

2 Torpedos Fired, 3 Left

Submarine Surfaced

Sample Input 2

10

2

Sample Output 2

Submarine Submerged

2 Torpedos Fired, 8 Left

Submarine Surfaced


sir plz provide the code for this program


Unite Family

Given three objects

father, mother, and child, write a JS program to concatenate all the objects into the family object using the spread operator.Input

  • The first line of input contains an object father
  • The second line of input contains an object mother
  • The third line of input contains an object child

Output

  • The output should be a single line string with the appropriate statement as shown in sample outputs

Constraints

  • Keys of the objects should be given in quotes

Sample Input 1

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

{'dish': 'puddings'}

{'pet': 'Peter'}


Sample Output 1

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"


Sample Input 2

{'surname' : 'Williams', 'city': 'Columbia'}

{'dish': 'cakes'}

{'pet': 'Rocky'}



Sample Output 2

Mr and Mrs Williams went to a picnic in Columbia with a boy and a pet Rocky. Mrs Williams made a special dish "cakes"

how it is possible these two out puts in console.log



Series of Operations

Given an array

  1. myArray of numbers, write a JS program to perform the following steps and log the result. Multiply each value with 9.
  2. Subtract 20 from each value.
  3. Multiply each value with 7.
  4. Log the values of the resulting array separated by a space

plz provide the code of this program



LATEST TUTORIALS
APPROVED BY CLIENTS