Week[1-7] Blogs.

Week 1:

Describe how you connect an HTML file and a JS file.

You can connect an HTML and JS file with a script tag along with the source.Included inside the HTML file.

<script src="file-name-example.js"></script>

Describe the difference between writing code in the Chrome console and writing HTML/JS files that are then open in Chrome.

When writing code in the chrome console it is usually to test things out and is temporary.The code isn’t saved when you write it in chrome.When you write code in an HTML/JS file and it is opened in chrome that is to make sure the code works.

Week 2:

How can you use “falsey-ness” to determine if a string value can be coerced to a number? Why does this work? What is “type coercion” anyway?

Falsey-ness is used to determine if a value is true or false.Coercion is the process of converting the type of one value to another.Number to string and vise versa.

What do you need to do to convert a for loop to a while loop? In order to convert a for loop to a while loop you have to restructure how it’s written.

Week 3:

Describe the difference between declaring a function and calling a function. Give an example in a code snippet using Enlighter. Have you example use an argument.

Declaring a function basically tells the computer what the function is and should do.Calling a function is executing what you told the computer to do.

function multiple (x) {
Return x * x

function test(x,y) {    return y – x;}

Week 4:

pop() removes a string from the end of the array,push() adds onto the end of the array,

shift() removes a string from the front of the array unshift() adds to the front of the array.

var colors = ["red", "green", "blue" ]
colors["red", "green", "blue"]

colors.push("orange") <!-- adds a string to the end of the array -->
colors.pop();     <!-- removes the last string in the array -->

Week 6:

Describe how the querySelector() and querySelectorAll() methods work. What is the difference between the values returned for each method? Use an example code snippet to support your answer; include sample HTML and JS selectors.

querySelector() is taking the CSS Style selector and It returns the first element that matches a given CSS Style Selector.

function test(){

querySelectorAll()  returns all matching elements instead of only one.

function test(){

Week 7:

Describe what the two arguments of the addEventListener method are and how they work. Give four examples of the first argument and give examples of using an anonymous function vs. a declared function for the second argument. Use the code-insert tool for your examples.

When  you use the addEventListener method the first argument is what the event listener is listening for. The second argument is what it does after its heard what it’s been listening for specifically.

document.addEventListener(“mouseover”, myFunction);
document.addEventListener(“click”, mySecondFunction);
document.addEventListener(“mouseout”, myThirdFunction);document.addEventListener(“change”, myOtherFunction);

Tutorial and problem-sets.

Join the Conversation

1 Comment

  1. Good that you were able to get some of the work up and post a number of answers to questions. Thanks for hanging in there.

Leave a comment

Your email address will not be published. Required fields are marked *