Skip to main content
Engineering LibreTexts

3.6: Exercises

  • Page ID
    27550
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    1. The following is Lincoln’s Gettysburg Address. Format this using HTML in JavaScript write statements so that each paragraph is separate, and the text is centered. The lines in your program should not be longer than 80 characters.
    2. Implement a file dialog in JavaScript, and alert the file name the user has chosen, or a message if no name is chosen.
    3. Research modal and non-modal dialog boxes. Discuss the difference between a modal and non-modal dialog? When would you use each?
    4. Write a program to read two numbers from textboxes, add them together, and display the answer. Your answer should represent addition (5+6 = 11, not 56).
    5. Write a program to read two strings from textboxes, append them together, and display the answer. What does this say operator overloading of the + operator? Can you overload the + operator in JavaScript to produce new semantics? What about other operators in JavaScript?
    6. Create an array of 7 elements. Delete the 3rd element (element number 2). What happens to the array?
    7. Create an array of 10 elements (e.g. var array = new Array(10)). Try adding 11 elements to the array. What happens?
    8. Create an array of 25 numbers. Using the JavaScript array sort with a Lambda function, sort the numbers highest to lowest. You may not use the reverse method, you must use a Lambda function.
    9. Process the form you developed at the end of Chapter 2.
    10. Agree or disagree with the following statement, and give your reasons. Lambda expressions as defined in Java are not true lambda functions, but syntactic sugar to hide anonymous inner classes.

    This page titled 3.6: Exercises is shared under a CC BY license and was authored, remixed, and/or curated by Charles W. Kann III.

    • Was this article helpful?