Details of this Paper

ComparisonOperators

Description

solution


Question

In this exercise, you will create a script that uses comparison;operators.;1. Create a new document in your text editor.;2. Type the declaration, element, header;information, and the element. Use the strict DTD and;?Comparison Operators? as the content of the element.;3. Add the following;element to the document body;Comparison Operators;4. Add the following script section and paragraph elements to;the document body;5. Add the following statements to the script section that perform;various comparison operations on two variables. Notice;that the fi rst comparison is performed using the conditional;operator.;var conditionalValue;var value1 = "Don;var value2 = "Dave;value1 == value2? document.write;value1 equal to value2: true;);document.write;value1 equal to value2: false;);value1 = 37;value2 = 26;conditionalValue = value1 == value2;document.write("value1 equal to value2:;+ conditionalValue +;);conditionalValue = value1 != value2;document.write("value1 not equal to value2:;+ conditionalValue +;);conditionalValue = value1 > value2;document.write("value1 greater than value2:;+ conditionalValue +;);conditionalValue = value1 = value2;document.write("value1 greater than or equal to value2:;+ conditionalValue +;);conditionalValue = value1 <= value2;document.write("value1 less than or equal to value2:;+ conditionalValue +;);value1 = 21;value2 = 21;conditionalValue = value1 === value2;document.write;value1 equal to value2 AND the same data type:;+ conditionalValue +;);conditionalValue = value1 !== value2;document.write;value1 not equal to value2 AND not the same data type:;+ conditionalValue + " ");6. Save the document as ComparisonOperators.html in the;Exercises folder for Chapter 2.;7. Use the W3C Markup Validation Service to validate the;ComparisonOperators.html document and fix any errors;that the document contains. Once the document is valid;close it in your text editor and then open it in your Web;browser and examine how the elements are rendered.;8. Close your Web browser window.

 

Paper#70014 | Written in 18-Jul-2015

Price : $27
SiteLock