Laura Shears

Answers

  1. JS Introduction: What are five things that JavaScript can do?
    You can make JavaScript do lots of things. Here are some examples.
    1. It can be an interface between 2 different technologies so they can work together. This is called an 'Application Program Interface' or API.
    2. You can write a separate JavaScript file to format all of the pages on your site, so that if you want to update the look of your site without updating the content, you just need to update the format page.
    3. You can make a picture slide show on a webpage with JavaScript.
    4. Scripts can be written so some parts of a page are hidden until you put a mouse over something or the user clicks on something.
    5. JavaScript can be coded to respond to what a person enters in a textbox. An exanple would be to have the user enter their first name in a box, the last name in a different box and then JavaScript can put the first name together, add an empty space, and then add the last name all into a single string that can be used to gret the person.
  2. JS Comments: How do you create a comment in JavaScript?
    For a single line comment you use 2 forward slashes:
    //This is a JavaScript comment since this text is after two forward slashes.
    /* For a block (multiline) comment, you use a forward slash and an star. Thus this is
    a multiline comment block. Everything after the forward slash star will be thought of us a comment
    until I close it with another star and blackslash combo but in the oppositite order.*/
  3. JS Operators: What arithmetic operators can JavaScript use on numbers?
    Look at these JavaScript examples to answer the question where x = and y = : Now you pick integers for x and y.
    x = , y =
  4. JS Strings: What is a string and how do you write a string?
    A string is a collection of characters used to display text. You can use the document.write() command to write a string or the getElementById() command. On this page I used: "document.getElementById("greeting").innerHTML = greetingStr;", where greetingStr is a string variable that uses the first and last name.