JavaScript/Test Basic JavaScript

From Wikiversity
Jump to navigation Jump to search

Portal:Engineering and TechnologySchool:Computer ScienceTopic:Computer ProgrammingTopic:JavaScriptBasic JavaScript → Test Basic JavaScript

Part One[edit]

  • Time required = 5 mins
  • Importance: Equivalent to the importance of learning how to type. Low
  • Requirements: take the test after learning basic JavaScript. The test requires the use of the alert() object. If you are still learning how to put JavaScript in a context for its use, then also study Debug or an equivalent lesson for the quick use of JavaScript through alerts from the JavaScript console. Additionally, you can simply just write the snippets in the questions between <script></script> tags in a standard HTML file. When the HTML is opened, in the browser, the alert will run as the window loads.

Start[edit]

1. How do you create a comment for your name?

[a 1]

<!--I put my name in script like this!-->

[b 1]

// I put my name in script like this!

[c 1]

# I put my name in script like this!

[d 1]

'I put my name in script like this!

Page javascript 48.png

2.

 var thisAdd = "1"+"2"; 
alert(thisAdd);

thisAdd will alert what value?

[a 2]thisAdd will alert "3".

[b 2]thisAdd will alert Undefined.

[c 2]thisAdd will alert 12.

[d 2]thisAdd will alert ERROR.

Page javascript 48.png

3.

 var thisMulti = "3" * 3; 
alert(thisMulti);

thisMulti will alert what value?

[a 3]thisMulti will alert Undefined.

[b 3]thisMulti will alert 33.

[c 3]thisMulti will alert ERROR.

[d 3]thisMulti will alert 9.

Page javascript 48.png

Part Two[edit]

Contributions[edit]

Part Two is optional. If you would like to test the JavaScript you're learning, and frame an opinion on some of the requirements (and differences) then complete the following.
Time: open-book, no time limit.
Title: title your effort.
Importance: equivalent to the initial learning curve required to write any wiki. Low
Definition: In this tutorial the student is required to create another five minute test using the basics of JavaScript and Wiki writing. Follow the instructions to create another five minute test:


Applications-accessories.svg
Activity: Copy the block (below this line) from the wiki plain text found in the edit box of this page in EDIT.


1. Put a question here?

Note 1:
 //show script like this

[a 4]

Put a very possible answer here.

[b 4]

Put a very possible answer here.

[c 4]

Put a very possible answer here.

[d 4]

Put a very possible answer here.

Page javascript 48.png

Repeat the question from this text three or four times with new questions.
Complete Below



Start here[edit]

Please sign with four tildes After you questions are created separate with four ----

Student Results[edit]

  • Select edit this page and create your test between Student Results and Answers here:

put test here


Answers[edit]

  1. Incorrect: This is for HTML
  2. Incorrect: 1 + 2 = 3 not "1" + "2".
  3. Incorrect: this alert will produce a result.
  4. (In)correct: add an explanation here

  1. Correct: This is for JavaScript comments
  2. Incorrect: this snippet will alert with a result.
  3. Incorrect: multiplications will not concatenate.
  4. (In)correct: add an explanation here

  1. Incorrect: This is for Python comments
  2. Correct: JavaScript will concatenate these strings and not be treated as numbers.
  3. Incorrect: this is a valid snippet.
  4. (In)correct: add an explanation here

  1. Incorrect: This is for Visual Basic comments
  2. Incorrect: this is a valid snippet.
  3. Correct: JavaScript will type cast "3" to a number then multiply.
  4. In)correct: add an explanation here