JavaScript => Logical Operators && Array Iteration || HTML DOM

Ashley Archibald
Apr 23 · 3 min read

Logical operators in Javascript are NOT(!), AND (&&), and OR(||). They are used to determine the logic between variables or values.

Logical operators are very important when it comes to coding, the results are based off whether the value is truthy or falsy.

(&&) AND Logical Operator

The && operator returns true if both expressions are true, otherwise the result will return false.

&& Operator

(!) NOT

When using the ! operator you must be in front of a value and the value will convert to a boolean and return an opposite value. Which means truthy values will return false, and falsy values will return true.


(||) OR

The or logical operator is used with two or more values but it evaluates true if any of the values are true. Which means if both values are false the return value will be falsy.


Array Iteration Methods

Iteration is the most common use of operations when it comes to programming. Loops help us iterate through an array repeatedly, quick and easy.

Array methods are properly written out as Array.prototype.method(), as Array.prototyperefers to the Array object itself. For simplicity, we will simply list the name as method().


The forEach() method executes a provided function once for each array element.



The .map() method creates a new array with the results of calling a provided function on every element.The map method does not change the original array.



The filter() method creates a new array with all elements that pass the test implemented by the provided function.



The reduce method runs a function on each array element to produce a single value. The reduce method works from left- to-right in the array.



The DOM is not a programming language, but without it, the JavaScript language wouldn’t have any model. DOM stands for Document Object Model. Every element in a document can be accessed and manipulated using the DOM and Javascript.The objects are represented in a node tree.

node tree

The parent stem is the root html and the child branches are the nested elements, and the leaves are the content with the elements.

node tree

The window object is the top, it is the outmost element of the object. The document object is the HTML document that contains the contents of the page. The form object contains the <form> tags set for the form object. Then the form object contains all the elements defined for that object such as text fields, buttons and checkboxes.The DOM element are DIV, HTML, BODY on the web page.

Locating DOM elements using selectors but can only be used on HTML elements.


Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade