Section 1

Preview this deck

Multi Paradigm Language

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (80)

Section 1

(50 cards)

Multi Paradigm Language

Front

Supports more than one programming paradigm - developers can work with a variety of styles within javascript.

Back

What are the 2 types of Numbers within Datatypes?

Front

Integer: Whole Number (-1, 450) Float:Decimal Point (0.1, 12.454)

Back

How do you add JS to your site externally?

Front

Add by externally linking to .js files.

Back

Comparison Operators

Front

Back

First Class Function

Front

Treats functions as first class citizens - you can do with functions everything you can do with other elements.

Back

The alert() function is not much used in JavaScript. What is it is useful for?

Front

It is often quite handy for trying out code.

Back

What kind of value does Boolean take?

Front

True or False

Back

Do While Loop

Front

Iterate while the condition is true do { ... this thing } while(condition);

Back

What type of language is JavaScript?

Front

It is a scripting language.

Back

What is best practice regarding variable declarations?

Front

Put variable declarations as close to the top of the scope as possible.

Back

How do you declare variables?

Front

using the var keyword - eg. var myName="Monica";

Back

Is JS case sensitive?

Front

Yes

Back

What are the properties of Global Scope?

Front

Outside a function, available to any code outside that function (also within).

Back

JS Statement

Front

A command that tells the browser what to do. document.write("hello world"); var myName="lorna";

Back

What would be the result of the following code? <script> document.write("<h1>This is a heading</h1>"); document.write("<p>This is a paragraph</p>"); </script>

Front

It will write what is between the <h1> and <p> tags to the browser screen formatted accordingly to the respective HTML tags

Back

Loops

Front

Repetitive Conditional statements. Used to perform a calculation a number of times, or to iterate over a set of variables.

Back

Are variables case sensitive?

Front

Yes

Back

How do you add JS To your site internally?

Front

Internally using html <script></script> tag. Best practice to place it before closing body tag .

Back

console.log(THING_TO_OUTPUT)

Front

A built-in JavaScript function that will push messages to the browsers error console. It is a very useful tool for debugging code, for seeing how variables are changing in your code. You can output strings, numbers, variables, objects, arrays and combinations of these for inspection.

Back

Objects

Front

Custom datatypes with properties and actions

Back

Math.random()

Front

Generates a random floating point number between 0 & 1. To convert this to a number range that we want - for example a random number between 1 & 10. First we multiply the result of Math.random() by 10 (the amount of potential numbers from 1 to 10) - this will give us numbers that range from 0 to 9.99999. Because Math.random() won't ever return the whole number 1 and to remove the decimal places, we use Math.ceil()to round the result of Math.random()*10 up to the nearest whole number. See more on the Math object.

Back

What are Strings within Datatypes?

Front

A line of text: "frog", "a red truck"

Back

What must a variable begin with?

Front

A letter, $ or _

Back

Function

Front

Re-useable blocks of instructions that can be executed by name. -Perform common tasks -saves time, reduces error function functionName (data) { repeat action here return outcome }

Back

Operators

Front

Used to assign values to variables and perform mathematical operations on them

Back

What are the properties of a Local Scope?

Front

Within a function, only available within function

Back

DOM

Front

Document Object model.

Back

Example of Conditional ELSE Statement

Front

Else statements allow us to make an alternative statement if original condition is false if (this condition is true){ ...do this thing }else{ ...do this other thing }

Back

Example of comparison operators

Front

var num = "5"; var numString ="5", ==Interpreted Value num ==numString (true) ===Interpreted value and data type num===numString(false)

Back

Can a statement be grouped into useable blocks called functions?

Front

Yes.

Back

What is DOM?

Front

Representation of HTML Page....

Back

Datatypes

Front

Numbers, Strings, Boolean, Arrays, Objects.

Back

What will an undeclared variable return?

Front

Undefined

Back

Conditionals

Front

Statements that allow for code to be executed against conditionals IF, ELSE statements

Back

Prototype Based

Front

Each object has a prototype that it inherits properties and abilities from

Back

For Loop Example

Front

Repeats until a specific condition becomes false

Back

Math Based Operators

Front

Back

Dynamic Typing

Front

Dynamic if the type of variable is interpreted at runtime.

Back

Three main types of Loops

Front

For: Set Number of Iterations While: Certain conditions are met Do...While: Certain condition is met

Back

Two types of variable scope?

Front

Local and Global

Back

What is a scripting language?

Front

A scripting language is a lightweight programming language.

Back

What will this code do? <p id="demo"> JavaScript can change the content of an HTML element.</p> <script> function myFunction() { x=document.getElementById("demo"); // Find the element x.innerHTML="Hello JavaScript!"; // Change the content } </script>

Front

It will change the text between the <p> tags to the content in quotes after x.innerHTML Hello JavaScript!

Back

What is a variable?

Front

Container for a piece of data

Back

What are the two ways to add JS to your site?

Front

Internally and Externally.

Back

What is Variable "Hoisting"?

Front

Variables are hoisted to the top of the function/statement. It is useful because you can refer to variables declared later in the code.

Back

While Loop Example

Front

Iterate while the condition is true while (condition) { do this thing }

Back

What happens if you call the "document.write" function after the document has fully loaded?

Front

The html document will be deleted and replaced by your new content.

Back

Function Example

Front

function sayHello(){ alert ("hello everyone!"); }

Back

Example of Conditional IF Statement

Front

if (This condition is true) {Do this thing} var Country = "Australia"; var Hemisphere, var Language; if (country = "England") { hemisphere = "northern"; language = "english"; }

Back

What is an Array?

Front

Used to store multiple values in a single variable. Real ["blue", "5", "123456"] Refer to the whole array using its variable name Arrays are indexed from 0

Back

Section 2

(30 cards)

parseInt: If the first character cannot be converted to a number, what is returned?

Front

NaN

Back

.textContent

Front

similar to .innerHTML

Back

clearInterval

Front

cancels a timed, repeating action which was previously established by a call to setInterval().

Back

ternary

Front

this.items = items !== undefined ? items : []; (if items is undefined, return items; otherwise return the array)

Back

Which index is zero based? (The first element is 0, the second is 1, and so on.)

Front

Array

Back

document.querySelector()

Front

Returns the first Element within the document that matches the specified selector, or group of selectors, or null if no matches are found.

Back

children

Front

children property returns a collection of an element's child elements, as an HTMLCollection object The elements in the collection are sorted as they appear in the source code and can be accessed by index numbers. The index starts at 0.

Back

button.addEventListener('click', () => { p.innerHTML = input.value + ':'; });

Front

When the button is clicked, the text between the <p> tags is changed per what is typed into input box

Back

unshift()

Front

Adds new elements to the beginning of an array, and returns the new length

Back

Object LIteral

Front

var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

Back

.addEventListener

Front

('click' ( ) { p.textContent = input.value })

Back

<script> var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"]; // ES5 // for(var i = 0; i < toys.length; i++){ // console.log(toys[i]); // } </script>

Front

for loop that prints all items in array

Back

<script> var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"]; // ES6 // for(var toy of toys){ // console.log(toy); // } </script>

Front

for of loop that prints all items in array

Back

intervalId

Front

let intervalID = setInterval(function() { console.log("Happening every 500ms!"); }, 500); clearInterval(intervalID);

Back

return

Front

ends function execution and specifies a value to be returned to the function caller

Back

What does parseFloat do?

Front

It parses its argument, and returns a floating point number. If it encounters a character other than a sign (+ or -), numeral (0-9), a decimal point, or an exponent, it returns the value up to that point and ignores that character and all succeeding characters. Leading and trailing spaces are allowed.

Back

document.querySelectorAll()

Front

Returns a list of the elements within the document (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors. The object returned is a NodeList.

Back

<script> var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"]; // jQuery // $.each(toys, function(index, value){ // console.log(value); // }); </script>

Front

The $.each() function internally retrieves and uses the length property of the passed collection.

Back

.innerHTML

Front

can read and alter the elements on a webpage

Back

What is the DOM?

Front

The DOM is a representation of a webpage that JavaScript can use.

Back

push()

Front

Adds new elements to the end of an array, and returns the new length

Back

What does this piece of code tell the computer to do ? x=document.getElementById("demo")

Front

Find the Element ("demo"); document.getElementById("some id") (The "Id" could be anything else.)

Back

shift()

Front

Removes the first element of an array, and returns that element

Back

splice()

Front

adds/removes items to/from an array, and returns the removed item(s)

Back

Math.random()

Front

This function returns a floating-point, pseudo-random number in the range 0 to 1 — that is, from 0 (inclusive) up to but not including 1 (exclusive) — which you can then scale to your desired range. The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user.

Back

childNodes

Front

The childNodes property returns a collection of a node's child nodes, as a NodeList object. The nodes in the collection are sorted as they appear in the source code and can be accessed by index numbers. The index starts at 0. Note: Whitespace inside elements is considered as text, and text is considered as nodes. Comments are also considered as nodes. Tip: You can use the length property of the NodeList object to determine the number of child nodes, then you can loop through all child nodes and extract the info you want.

Back

pop()

Front

Removes the last element of an array, and returns that element

Back

z-index

Front

The z-index CSS property specifies the z-order of a positioned element and its descendants. When elements overlap, z-order determines which one covers the other. An element with a larger z-index generally covers an element with a lower one.

Back

What does this piece of code tell the computer to do? x.innerHTML="Hello JavaScript!";

Front

Change the content of the x variable to Hello JavaScript!

Back

Object Prototype

Front

function Person(first, last, age, eyecolor) { this.firstName = first; this.lastName = last; this.age = age; this.eyeColor = eyecolor;

Back