code reading Flashcards
-!doctype html-
there is a doctype element declaration with the value html?
title - (html skeleton) -/title
There is the opening tag for the title element with the text content of html skeleton, followed by the closing tag for the title element.
-p- © Pokemon. ® Nintendo. -/p-
there’s an opening tag for a paragraph element with a text content of an escape entity ampersand copy; pokemon. Ampersand reg; Nintendo. Then a closing tag for the paragraph element.
-a href=”%E2%80%9Dindex.html%E2%80%9D”>homepage-/a-
opening tag for anchor element with an href attribute of index.html with a text content of homepage and then a closing tag for the anchor element.
input (opening input tag)
there is an input element… (not opening tag for input element, since there’s no closing tag).
h2#JS { color: blue;}
There is a selector for THE h2 element with the ID of JS. Inside of the declaration, there is a property of color with the value of blue.
Body { color: #090302; font-family: sans-serif;}
“on line 1 there is a css selector for all elements of type body/(for all article elements) and the opening curly brace for the declaration block. On line 2 there is a color property with the value of hex code seen here. On line 3 there is a font family property with the value sans serif, and on line 4 there is a closing curly brace for the declaration block.”
border: 1px solid;
“there is a border shorthand property with the value of 1px and solid”
.title
There is a css selector for all elements with the class ‘title’.
body{ background-color: rgb (200, 233, 255);}
there is a background-color property with the value of the rgb css function with the values 200, 233, 255
font-family: ‘cabin’, sans-serif.
there is a font family prop with a value cabin, and a fall back value sans-serif
.custom-button:hover
there’s a css selector all elements with the class custom button and the pseudo class hover
table.striped thead > tr
there’s a css selector for all tr elements which are direct children of a thead element that is a descendant of the table element with the class striped.
Table.striped tbody > tr:nth-child(odd)
there’s a css selector for all tr elements with the pesudo class nth child with the argument odd, which is a direct child of a tbody element which is a descendant of a table element with class striped
html (opening html tag)
there is an opening tag for the html element.
/head (closing head tag)
there is a closing tag for the head element
-img- src=”url” width=” 700px alt=”text” -
There is an image tag with a source attribute set to “url”, a width attribute set to 700pixels, and an alt attribute set to “text”.
Body { color: #090302; font-family: sans-serif;}
“on line 1 there is a css selector for all elements of type body/(for all article elements) and the opening curly brace for the declaration block. On line 2 there is a color property with the value of hex code seen here. On line 3 there is a font family property with the value sans serif, and on line 4 there is a closing curly brace for the declaration block.”
border: 1px solid;
“there is a border shorthand property with the value of 1px and solid”
.title
There is a css selector for all elements with the class ‘title’.
body{ background-color: rgb (200, 233, 255);}
there is a background-color property with the value of the rgb css function with the values 200, 233, 255
font-family: ‘cabin’, sans-serif.
there is a font family prop with a value cabin, and a fall back value sans-serif
.custom-button:hover
there’s a css selector all elements with the class custom button and the pseudo class hover
table.striped thead > tr
there’s a css selector for all tr elements which are direct child of athead element that is a descendent of the table element with the class striped.
Table.striped tbody > tr:nth-child(odd)
there’s a css selector for all tr elements with the pseudo class nth child with the argument odd, which is a direct child of a tbody element which is a descendant of a table element with class striped
-p-blahblah- em-beautiful-/em- blah blah -/p-
There is an opening tag for the p element…then an opening tag for em tag with text content beautiful, with a close tag for the em element, and text content
var firstName = ‘Keenan’
on line one the string ‘keenan’ is being assigned as the value of the variable named firstName.
Var age = 25
the numeric literal, 25, is assigned to the variable named ‘age’.
var address = number + street
the value of the variable number is being concatenated/added with the value of the variable street, and the result of that expression (any work that needs to be done by js) is assigned to the variable address.
-NOTE, with concatenation, and maybe all js, just reading it in normal order. Don’t start from the absolute farthest right thing and working your way left. So don’t say street is being added
varbio=’Mynameis’+firstName+’‘+lastName+’andIam’+age+’yearsold.’
the string my name is is being concatenated with the value of the variable first name which is then concatenated with the string space which is then concatenated with the value of the variable last name which is then concatenated with string I am and then concatenated with value of variable age then concatenated with the string years old. And the result of that concatenation is being assigned to the variable named ‘bio’.
Console.log( typeof bio);
the log method of the console object is being called with 1 argument: the result of the expression of the typeof operator being used against the value of the variable bio
varcheap=price< 100
the value of the variable price is being checked to see if it is less than the number 100, and the result of that expression is being assigned to the variable named cheap
var nullVariable = null;
the value null is being assigned to the variable named nullVariable.
function addTwoNumbers(a, b) { return a + b)
line 1 there is a function definition named addTwoNumbers with two parameters, a and b, and the opening curly brace for the function code block
on line 2 the value of the variable ‘a’ is being added with the value of the variable ‘b’, and the result of that expression is being returned by the function.
Function typeofdata(data) { return typeof data }
there is a function definition named typeofdata that takes a single parameter of data, opening curly brace for the function code block, on next line, the typeof operator is being used against the value of the variable ‘data’, and the result of the expression is being returned by the function. Then a closing curly brace for the function code block.
if(value1 < value2) {
console.log(‘value1 is smaller’);
} else console.log(‘value2 is smaller’);
on line 18 there is an if statement with a condition checking if the value of the variable value1 is less than the value of the variable value2, then the opening curly brace for conditional code block
on line 19 the log method of the console object is being called with one argument; string “value1 is smaller”);
on line 20 is an else statement. and then the log method on the console object is called with one argument, a string with the value ‘value 2 is smaller’)
if(value2>=value1&&value2<=value4)
if(value2>=value1&&value2<=value4)
on line 32 there is an if statement with a condition checking if the value stored in variable 2 is greater than or equal to the value stored in variable 1. AND checking if the value stored in variable value2 is less than or equal to the value stored in variable value4
(value2>=value1&&value2<=value4)
there is an if statement with a conditional checking if the value of the variable value 2 is greater than or equal to the value of the variable2 AND if the value of variable value2 is less than or equal to the value of the variable value4.
switch(operator) {
case “+”:
result = num1 + num2;
break;}
on line 16 there is a switch statement with an expression checking the value of the variable ‘operator’.
There is a case statement checking for the string “+”, on the next line, the value of the variable num1 is being added to the value of the variable num2, and the result of that expression is being assigned to the variable named result.
on the next line there is a break statement.
varstudent={ firstName:'Keenan', lastName:'Ng', age:29 }
line one there is a object literal being defined. on line 2 there is a property of firstName assigned a value of string Keenan…. Last name: skywalker… age 25.
And that object literal is being assigned to the variable ‘student’.
varstudentsName=student.firstName+’‘+student.lastName;
The value stored at the firstName property of the student object is being concatenated with the string ‘space’ which is being concatenated with the value stored at the lastName property of the student object.
console.log(‘Mycar’,myCar);
the log method on the console object is being called with the value contained in the variable ‘myCar’
varcolors=[‘red’,
‘white’,
‘blue’];
on line 1 there is an array literal with values string red, string white, and string blue, as its contents, and that array literal is being assigned to the variable named colors
console.log(‘FirstArrayIndex:’,colors[0]);
the log method of the console object is being called with 2 arguments: the string first array index”, and the value at the 0 index of the colors array.
Colors[2] = ‘green’
the string value of green is being assigned to the 2 index of the colors array.
Var amountOfStudents = students.length
the value of the length property of the students object/array is being assigned to the variable named amountOfStudents.
(don't read: var amtOfStudents = students.length) varlastStudentInArray=students[amtOfStudents - 1];
The value of the variable amtofstudents is being subtracted by 1 and the result of that expression is being used as the index of the students array, and the value at that index, is being assigned to the variable named lastStudentInArray.
var library = [ ];
There is an empty array literal being assigned to the variable named library
console.log(library[0].title);
the log method on the console object is being called with one argument:
the value of the title property of the object at the 0 index of the library array
Library.push(book)
the push method of the library array is being called with a single argument of the value stored in the variable book.
console.log(‘==1’, “5”==5);
the log method of the console object is being called with 2 arguments. The first argument is the string ‘double equals 1’ the second argument is an expression checking to see if the string ‘5’ is loosely equal to the numeric literal 5’.
if (value2 < value3 || value2 > value4)
there is an if statement with a condition checking if the value of the variable value2 is less than the value of the variable value3 OR the value of the variable value2 is greater than the value of the variable value4
read the title line only. var library = [ { title: 'the road ahead', author: 'Bill Gates', libraryID: 1254 ),
on line 3 the string with the value ‘the road ahead’ is being assigned to the property ‘title’.
console.log(library[0].title)
the log method of the console object is being called with a single argument, the value of the ‘title’ property of the object at the 0 index of the ‘library’ array.
var box1 = document.getElementById(‘box1’)
the getElementById method of the document object is being called with the single argument of the string ‘box1’. And the return from that method is being assigned to the variable named box1.
box1.classList.remove(‘blue’)
the remove method of the object within the classList property of the box1 object is being called with the single argument, string blue.
box1.classList.add(‘red’)
The add method of the object within the classList property of the box1 object is being called with the argument of the string red.
Box2.style.height=”150px”;
The string 150 pixels is being assigned as the value for the height property of the object within the style property of the box2 object.
var textElement = document.getElementById(‘h1tag’)
the getElementById method on the document object is being called with the single argument of the string h1tag. And the return of that method is being assigned to the variable named textElement.
Var elementText = textElement.textContent;
The value of the textContent property of the textElement object is being assigned to the variable named elementText.
ElementText += “, you have properly manipulated text!”
the string “, you have properly manipulated text!” is being added to the current value, AND SAVED within the variable ‘elementText’.
textElement.textContent = elementText
The value of the variable elementText is being assigned as the value to the textContent property of the textElement object.
Var inputElement = document.getElementById(‘textInput”);
The getElementById method of the document object is being called with one argument, string ‘textInput’. And The return of that method is being assigned to the inputElement variable.
Var inputValue = inputElement.value
the value of the ‘value’ property of the inputElement object is being assigned to the variable named inputValue.
InputElement.value = 867.
The number 867 is being assigned to the value property of the inputElement object.
InputElement.value = valueUpdate
The value of the variable valueUpdate is being assigned as the ‘value’ of the value property of the inputElement object.
Var valueUpdate = inputValue += 5309
The number 5309 is being added to the current value of the variable inputValue and assigned as the value for the value of inputValue as well as the value of the variable valueUpdate
Alternate that follows the other flashcard:
The number 5309 is being add to the current value of and saved within, the variable ‘inputValue’, which is then assigned to the variable named valueUpdate
var clickButton = document.querySelector(‘#clickbutton’);
the querySelector method of the document object is being called with a single argument, string #clickbutton, and the result of that method is being assigned to the variable clickButton
clickButton.addEventListener(‘click’, handleClick);
the addEventListener method of the clickButton object is being called with two arguments. The string ‘click’ and the variable handleClick. (value stored within the variable handleclick?)