Week 2: JavaScript and jQuery Flashcards
JavaScript
JavaScript is a programming language used to make web pages interactive. Like HTML and CSS, you do not need to install anything to begin writing JavaScript or see it run on your users’ computers. All modern browsers support JavaScript which means JavaScript that you write for your web pages will automatically run when your visitors load your web page in their browsers. In fact, JavaScript is the only scripting language that all browsers support so if you want a page to have dynamic content, learning JavaScript is a must.
jQuery
jQuery is a JavaScript library that makes it easier to incorporate JavaScript on your web pages. When we say it is a library, we mean that many common tasks that would take many, many lines of JavaScript code to execute have been packaged into methods that you’ll be able to use with a single line of code.
The only 3 things a web browser can do:
- Display content with HTML
- Style it with CSS
- Change what’s displayed with JavaScript
Modulo
% operator that will give you the remainder of dividing two numbers.
Operators
An operator is a special character (or characters) that indicates an action to be performed.
Examples: +, -, *, /, %
NaN
Stands for not a number, and is a result of dividing 0 by 0.
Infinity
Dividing anything by 0. Also considered a number.
Tips for naming JavaScript variables:
- Variables should begin with a letter.
- Variables are case sensitive (myNumber is a different variable than myNUMBER).
- Use clear names that describe the value being stored like myNumber.
- Always name your variables in a manner that will be easy for other developers to understand. Avoid vague letters or initials. (For example: var x = 45 doesn’t tell us what the value is. Is 45 an age, a distance, size, a time?…)
Variable
Variables can be thought of as containers used to store information. They allow for a way to label data with a descriptive name.
A variable is just standing in for the number it represents.
Lower camel case
Use lowerCamelCase when naming JavaScript variables. Start with a lowercase letter, and if the variable name is more than one word, remove all spaces and capitalize the first letter of each subsequent word.
String
a JavaScript data type that represents the exact text of whatever is enclosed in the quotes
Method
A method is an action run on a piece of data; you can think of it as a message you send to a piece of data, and the result is the response.
Return value
The return value is the method’s response.
Argument
Some methods take one or more arguments that provide the method with additional information to help it perform its action.
Chaining methods
Calling a method directly on the return value of another method.