It is a good idea to open the HTML file in Live Server (if using VS Code) or a browser and check your code frequently. The easiest way to find errors is to see them as soon as you make them! It is also a good idea to open the browser console to see if there are any errors. 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.
product of array items
given an array integers, write a JS program to get the product of the given integers in the array
sample input1
[1,2,3]
sample output1
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 */
}
INPUT:
[1,2,3]
OUTPUT:
1*2*3 = 6
INPUT:
[-1,-2,-3]
OUTPUT:
-1*-2*-3 = -6 SHOULD BE LIKE THIS
given an object person containing a person details, write a JS program to log the name, address & nicknames count
input
{ 'name':'Pranay', 'address':{'city':'Mumbai','state':'maharastra'}, 'nicknames':['nani','chanti']}
output
pranay is from mumbai,maharastra
pranay has 2 nicknames
"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 person = JSON.parse(readLine().replace(/'/g, '"'));
/* Write your code here and log the output */
}
Magical Indices
Given an array of integers and a number x.An index is valid if
item y at an index is increased by x and
x+y would be greater than the sum of all other items in the array
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.
input:
[1, 2, 3, 5, 7]
13
output:
3
input:
[34, 32, 37, 38, 40]
10
output:
person details:
Give an object person containing a person details, write Js to log the name, address ,nicknames count.
input: The input will be a single line containing an object person
output: The first line of out put should contain the name and address of the person as shown in the sample output
The second line of output should contain the nicknames count of the person as shown in the sample output.
Constraints: The keys of object should be in quotes while giving the input.
input:{'name': 'Pranay', 'address': {'city': 'Mumbai', 'state': 'Maharashtra'}, ' nickNames': ['Nani', 'Chanti ']}
out put become:
Pranay is Mumbai, Maharashtra
Pranay has 2 nicknames.
Cumulative Sum
given an array integers, write a JS program to get the cumulative sum of the items in the array
sample input1
[1, 10, 100, 1000]
sample output1
[1, 11, 111, 1111]
"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 */
}
Magical 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.
Sample Input 1
[1, 2, 3, 5, 7]
13
Sample Output 1
3
"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());
let value = JSON.parse(readLine());
/* Please do not modify anything above this line */
/* Write your code here and log the output */
}
product of array items
given an array integers, write a JS program to get the product of the given integers in the array
sample input1
[1,2,3]
sample output1
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 */
}
INPUT:
[1,2,3]
OUTPUT:
1*2*3 = 6
INPUT:
[-1,-2,-3]
OUTPUT:
-1*-2*-3 = -6 SHOULD BE LIKE THIS
Create and test an HTML document that has at least a half-page of
text and a small box of text embedded on the left margin, with the main
text flowing around the small box. The embedded text must appear in a
smaller font and also must be set in italic.
In a new index.html file display three images (that you would be legally allowed to use for a commercial project) and do the following: