IT Review JAVASCRIPT
(Can someone please help me answer the below questions. It would be nice if you add comments explaining what you are doing? If unable to add comments the answer would be fantastic. Thank you.
function percent(x)
{
return x / 100;
}
Which of the following statements correctly calls the percent function:
Indicate whether each of the following evaluates to true or false, given x = 3, y = 2, z = 1.
For example, formatName(“elmer”, “fuDD”) should return “E. Fudd”
Your function may assume that firstName and lastName are string values containing at least one character.
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Question :
Answer : a.percent(10);
Here a new web page with name "simpleJS.html" is created, which contains following code.
simpleJS.html :
<script>
//function defination
function percent(x)
{
return x / 100;
}
//function call
var result=percent(10);
//displaying value of result
document.write(result);
</script>
======================================================
Output : Open web page simpleJS.html in the browser and will get the screen as shown below
Screen 1 :simpleJS.html
*************************************
Question :
Answer :
Consider following code :
<script>
var x = 3;
var y = 2;
var z = 1;
document.write("z != y && y == (y + z) % (x + y) : "+(z != y && y == (y + z) % (x + y))+"<br>");
document.write("y * z >= x + y * z || x + y * z < z * (x + y) :" +(y * z >= x + y * z || x + y * z < z * (x + y))+"<br/>");
document.write("!(y > z) && z >= z / y - x : "+(!(y > z) && z >= z / y - x)+"<br/>");
document.write("x <= y && y <= z % x && z / y > x) : "+(x <= y && y <= z % x && z / y > x)+"<br/>");
document.write("true == 'true' : "+(true == 'true')+"<br/>");
document.write("5 === 5.0 : "+(5===5.0));
</script>
=====================
Open web page in the browser and will get the screen as shown below
******************************
Question :
Answer :
Here a new simple web page with name "simpleJS.html" is created which contains following code.
simpleJS.html :
html lang="en">
<head>
<!--title for web page -->
<title>Javascript Basics</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--div that display total -->
<div id="total">
<!--script is used for javascript -->
<script>
//declaring variable
var sum=0;
//using for loop that goes from 5 to 15
for(var i=5;i<=15;i++)
{
//checking if value of i is odd or even
if(i%2!=0)
{
//if odd add number to sum
sum=sum+i;
}
//getting div element
document.getElementById("total").innerHTML="Total is : "+sum;
}
</script>
</body>
</html>
======================================
Output :Open web page simpleJS.html in the browser
and will get the screen as shown below
Screen 1 :simpleJS.html
************************************
Question :
Answer :
Here a new web page with name "demoJS.html" is created which contains following code.
demoJS.html :
<!DOCTYPE html>
<html lang="en">
<head>
<!--title for web page -->
<title>Javascript Basics</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--button -->
<button id="myBtn">Click Me</button>
<br><br>
<!--span to disply button value -->
<span id="mySpan"></span>
<!--script is used for javascript -->
<script>
//getting div element
var btn=document.getElementById("myBtn").innerHTML;
//displaying on span
document.getElementById("mySpan").innerHTML=btn;
</script>
</body>
</html>
=========================
Output :Open web page demoJS.html in the browser and will get the screen as shown below
Screen 1 :demoJS.html
************************
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
IT Review JAVASCRIPT (Can someone please help me answer the below questions. It would be nice...
Can someone please help me with this javascript - Javascript - do at least 10 of the following questions below ----------------------------------------------------------------------------------- Create an HTML file that takes in input and carries out of the following functions and manipulates the DOM to show the outcome. Please put the question itself as a comment above each answer. Use either JavaScript, jQuery, or both (but know the difference!). ----------------------------------------------------------------------------------- 1. Fibonacci Define function: fib(n) Return the nth number in the fibonacci sequence. 2....
This is my code so far: <!DOCTYPE html> <html> <head> <title>JavaScript is fun</title> <meta charset="utf-8" /> </head> <body> <script type ="text/javascript"> //declare a variable and store text in it var x = "JavaScript is fun"; //write the variable 5 times document.write(x + x + x + x + x); //store 5 as string in variable x x = "5"; //store 3 as string in variable y var y = "3"; //write the value x + y to the document document.write("<br>");...
NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...
using C++ language!! please help me out with this homework In this exercise, you will have to create from scratch and utilize a class called Student1430. Student 1430 has 4 private member attributes: lastName (string) firstName (string) exams (an integer array of fixed size of 4) average (double) Student1430 also has the following member functions: 1. A default constructor, which sets firstName and lastName to empty strings, and all exams and average to 0. 2. A constructor with 3 parameters:...
Hello can someone help me in my code I left it as comment task #0, task#1, task#2a and task#2b the things that I am missing I'm using java domain class public class Pizza { private String pizzaCustomerName; private int pizzaSize; // 10, 12, 14, or 16 inches in diameter private char handThinDeep; // 'H' or 'T' or 'D' for hand tossed, thin crust, or deep dish, respecitively private boolean cheeseTopping; private boolean pepperoniTopping; private boolean sausageTopping; private boolean onionTopping; private boolean...
Can someone please help me for this assignment? Cryptography — the science of secret writing — is an old science; the first recorded use was well before 1900 B.C. An Egyptian writer used previously unknown hieroglyphs in an inscription. We will use a simple substitution cypher called rot13 to encode and decode our secret messages. ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in...
can someone help me answer the following #Fsharp multiple choice questions along with explanations for each question please. 7. How does F# interpret the type int * bool -> string list? Select one: a. (int * (bool -> string)) list b. ((int * bool) -> string) list c. int * (bool -> (string list)) d. (int * bool) -> (string list) 8. Let F# function foo be defined as follows: let rec foo = function | (xs, []) -> xs...
Can someone help fix this JAVASCRIPT code according to comment instructions javascriot code: window.addEventListener("click", () => { console.log("You clicked?"); }); let button = document.querySelector("button"); button.addEventListener("click", () => { console.log("First Button clicked."); }); // How can we modify this so that it will occur when the 2nd button is clicked? // We need to use querySelectorAll which will produce a nodelist/array of all the buttons. Then we can reference which button we want to apply the click event using [] with...
can someone please help me with this 3 questions? What is the molar solubility (in mol L') of a salt in pure water with general molecular formula MX2 (where M is a cation and X is an anion) that has Ksp = 7.70 x 10-9? You have 5 attempts at this question. Remember: if you want to express an answer in scientific notation, use the letter "E". For example "4.32 x 10" should be entered as "4.32E4". Answer: Check What...
please help me with this python code thank you 1. Write a Student class that stores information for a Rutgers student. The class should include the following instance variables: (10 points) o id, an integer identifier for the student o lastName, a string for the student's last name o credits, an integer representing the number of course-credits the student has earned o courseLoad, an integer representing the current number of credits in progress Write the following methods for your Student...