Monday, November 18, 2019

BlogPost_204

-Describe one thing you're learning in class today.
We are learning what high order functions are.
-Can you describe the main difference between a forEach loop and a .map() loop and why you would pick one versus the other?
You use map when you want to do something to an array or a list and forEach when you want to do something with that array.
-Describe event bubbling.
It relates to the order in which event handlers are called when one element is nested inside a second element, and both elements have registered a listener for the same event(a click, for example).
-What is the definition of a higher-order function?
A function that does at least one of the following: a)takes one or more functions as arguments. b)returns a function as its result.

-ES6 Template Literals offer a lot of flexibility in generating strings, can you give an example?
console.log('string text line 1\n' +
'string text line 2');
// "string text line 1
// string text line 2"

-What Is an Associative Array in JavaScript?
A mechanism that shares a lot of superficial similarity to the array is the associative array or hash, which in JavaScript is actually a class of object rather different than real arrays in that they can be indexed by non-numeric objects (like strings).

-What is array?
An array is collection of items stored at contiguous memory locations. The idea is to store multiple items of same type together. This makes it easier to calculate the position of each element by simply adding an offset to a base value, i.e., the memory location of the first element of the array (generally denoted by the name of the array).

-Why Never Use New Array in JavaScript?
This question is too vague. Please rephrase. 

Saturday, November 9, 2019

BlogPost_203

1-Describe one thing you're learning in class today.Today in class we went over how to plan what you'll do before starting to code. We created a text file called readme.md into which we typed detailed instructions of what we want the thing we're building to do. This was very helpful and I learned that it is easier to go about programming having a clear plan of what you're doing before writing any code. 

2-Difference between:
a) function Person(){} b) var person = Person(), and c) var person = new Person()

a) is declaring a function. b) is assigning a variable to call the Person( ) function. c) is creating an object based on the person function.

3-What's the difference between an "attribute" and a "property"?Attributes are in the HTML itself rather than in the DOM. JS DOM Objects have properties and can be accessed using jQuery's prop method. These properties we set in the HTML but are not in the HTML itself like attributes are.

4-What language constructions do you use for iterating over object properties and array items?for loop, for..in, for each..in, map, reduce etc.

5-What is the event loop?It is a design pattern that waits for and dispatches events or messages in a program. It makes Node capable of handling highly concurrent requests while still running "single-threaded". There is generally a main loop that listens for events, and then triggers a callback function when one of those events is detected. 

6-What is the difference between call stack and task queue?So in short, a job queue is a queue of things to do (usually stored persistant) and a call stack is a stack of routines. A call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack".A job queue (sometimes batch queue), is a data structure maintained by job scheduler software containing jobs to run.

7-What are the differences between ES6 class and ES5 function constructors?ES6 class basically does the work of defining a new object and appending functions to its prototype. ES5 Function constructors work and look the same but the main difference is observed when the developer uses the Inheritance property.
ES6 can be considered as the syntax base for constructor functions. ES5 can only be executed with the help of a new operator.
ES6 class allows the developers to instantiate objects using the new operator. ES5 function constructors focus on how the objects are instantiated.
ES6 also ensure the developer that this keyword which is basically used inside the class only refers to the object that is being created by the developer. ES5 function constructor focus on implementing the reusable object creation code. Any function can be used as a constructor.





Tuesday, November 5, 2019

BlogPost_202

  1. Describe one thing you're learning in class today.
Well I was not in class that day I´ll be honest but I have been learning a about how to use arrays and array methods. That and the for loops has been pretty interesting.

2. What is "use strict";? what are the advantages and disadvantages to using it?

The purpose of "use strict" is to indicate that the code should be executed in "strict mode". With strict mode, you can not, for example, use undeclared variables. ... It helps you to write cleaner code, like preventing you from using undeclared variables.

3. Explain "hoisting".

Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. Inevitably, this means that no matter where functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local.

4. Explain the importance of standards and standards bodies.

These bodies or organizations publish documents to keep a standard so everything is described properly, it´s organized and the people involved can follow up on what they´re developing. They are important because if they didn´t exist the web would just be chaos. Everybody would do whatever they want and there wouldn´t be an organized document where you could read how to implement new coding solutions. It makes it very efficient for coders and for consumers to be able to take advantage of new technologies.

5. What actions have you personally taken on recent projects to increase maintainability of your code?

I have commented the code thoroughly so that I don´t get confused if I have to make a change in the future and I don´t feel familiar with the code anymore. I´ve also sometimes left commented out code with instructions on how to use it in case someone want to implement that part of the code. 

6. Why is extending built-in JavaScript objects not a good idea?

Well first because you could get confused pretty quickly and your code could behave erratically. You could also break the default functionality. It´s just not good practice. 

7. Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?

For Javascript it has more severe consequences. It´s harder to read the code and reason about it when variables seem to appear out of thin air. Also, anyone can update a global variable from any point in the program at any time. You can also encounter variable name clashes. 

BlogPost_201

  1. Describe one thing you’re learning in class today.
In class I googled about how to write an if statement and then found out with the feedback from the professor that I had to use methods to complete the task at hand. I found about the trim method for a string and applied it along with a method to bring all characters in a string to lowercase.
  1. How do you ensure that your website design or web application is accessible and user-friendly?
There´s a lot of options here. An option could be to run some tests with real people to get feedback from them. Another option is to hire a UX Professional to help with the design of the website or web application. Lastly and the least reliable way would be to run by intuition.
  1. What are your favorite features of HTML5, and how have you implemented them in your front end development projects?
I have used the video player and canvas. Those two are my favorite features. I implemented the video player in a website and I like how fast it is compared to other alternatives.
  1. How do you structure your CSS and JavaScript to make it easier for other developers to work with?
On separate files.
  1. What’s your process for addressing browser-specific rendering problems? Do you find that a certain browser is more challenging to work with than others?
I normally use Google Chrome and if something doesn´t work there I normally don´t care. I´m of the idea that if someone is using an old browser it´s their fault and not mine. I don´t find it challenging to add the code to make it work with older browsers but I like the darwinistic idea of not doing so to force people to update their browsers. Sorry not sorry. :)
  1. What is the difference between == and === ?
=== is used for comparision between two variables but this will check strict type, which means it will check datatype and compare two values.
== is used for comparison between two variables irrespective of the datatype of variable.
  1. What is the value of foo? var foo = 10 + '20';
The value of foo is 10 + '20'. If you run it the value of foo will be 1020. ;)
  1. Describe what a terminal application is?
A terminal application is a non-graphical computer interfase that allows a user to control the computer with text based commands.
  1. What is the ternary operator?
The ternary operator is an operator that takes three arguments. The first argument is a comparison argument, the second is the result upon a true comparison, and the third is the result upon a false comparison. If it helps you can think of the operator as shortened way of writing an if-else statement.