From d7e7d1a473d4f3c6558dd528588dfeb2854ce6aa Mon Sep 17 00:00:00 2001 From: liza Date: Sun, 19 Mar 2017 14:33:57 +1100 Subject: [PATCH 1/2] Fixed heading formatting so it displays correctly in Github, added 2nd level headings, improved formatting for code blocks --- README.md | 8 ++--- cheat-sheet.md | 87 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index b727c4a..d9fea92 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ An introductory JavaScript workshop for beginners. -##Slides +## Slides Check on slides, click [here](https://slides.com/tanyabutenko/ngs-intro/) -##Feedback +## Feedback To leave feedback click [here](https://goo.gl/forms/MxDr9q2A4PQV4CRI3) -##How to use +## How to use _______________ @@ -33,7 +33,7 @@ Follow the instructions in _level1.js_ file and type code in your Text Editor (i -##Structure +## Structure ____________________ diff --git a/cheat-sheet.md b/cheat-sheet.md index d01d24e..55bafe6 100644 --- a/cheat-sheet.md +++ b/cheat-sheet.md @@ -1,119 +1,146 @@ # JavaScript Cheatsheet -###JavaScript (or JS) +## JavaScript (or JS) It is a popular programming language commonly used to create interactive effects within web browsers. -###variable +## variable A place to store values, can store any kind of information (data types): numbers, words, collections of data -###undefined variable +### undefined variable A variable that has no value -###to declare variable +### to declare variable -To create a variable - done by using ‘ var variable-name = value ’ +To create a variable - done by using: +``` +var variableName = value; +``` -###to initialize variable + +### to initialize variable Set (give) some value to variable. -###string +## value types + +### string A set of characters, word(s), phrase. To initialize variable with a string you need to put this string into quotes. -###boolean +### boolean Boolean variable represent a logical value True or False -###array +### array An ordered list of values, can store different types of data inside -###operator +### operator Mathematical operators, such as: +, -, *, /, >, <, = etc -###comments +## comments + +Comments are some notes that you can leave for yourself or another person, a note that a computer will not read. You can write a comment on a new line or on the same line after code as so: -Comments are some notes that you can leave for yourself or another person, a note that a computer will not read. You can write a comment on a new line or on the same line after code as so: //I’m your comment -Single line comment starts with // -Multi line comment are placed between /* .. */ +``` +// I’m your comment +``` +Single line comment starts with `//` +Multi line comment are placed between `/* .. */` -###function +## function A separable, reusable piece of code. It takes some input, does some manipulation on it and returns us an output. -###to declare function +### to declare function To create a function -###argument +### argument A value input that functions can accept -###if/else statement +## if/else statement -‘If’ used to decide which lines of code to execute, ‘else’ - to give alternative set of instructions. Example: if(x > 5) {console.log”X bigger than 5”}; else {console.log”X smaller than 5”}; +`if` used to decide which lines of code to execute, `else` - to give alternative set of instructions. +Example: -###while loop +``` +if (x > 5) { + console.log("X bigger than 5"); +} +else { + console.log("X smaller than 5"); +} +``` + + +## while loop It repeats code over and over again until some condition is met. -###for loop +## for loop + +This loop is similar to ‘while loop’, just with a set amount of repetition. You declare counter in the statement as so: -This loop is similar to ‘while loop’, just with a set amount of repetition. You declare counter in the statement as so: for(var i = 0; i < 5; i++){do something 5 times}; +``` +for (var i = 0; i < 5; i++) { + do something 5 times +} +``` -###infinite loop +## infinite loop A loop that does not stop and it’s a loop that you need to avoid. Each loop should have some condition so it can stop. -###object +## object A collection of properties -###event +## event A type of object that is created when a user interacts with a web page. For example, JavaScript creates an event when a user clicks on a button. -###CSS +## CSS Stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen. It is presentation. -###HTML +## HTML Stands for Hyper Text Markup Language. It is a structure of the elements on the page. -###DOM +## DOM Stands for Document Object Model. It defines the logical structure of documents and the way a document is accessed and manipulated. -###scope +## scope Scope is the set of variables, objects, and functions that you can access. -###console +## console A method of interacting with the system. In order to write to the browser console, you could use console.log(‘Hello World’). This would write Hello World in the browser console. From 9113a872060c148fd6d343fd668e9fa1b8674b3f Mon Sep 17 00:00:00 2001 From: liza Date: Sun, 19 Mar 2017 14:44:34 +1100 Subject: [PATCH 2/2] Removed horizontal lines since it doubles up in Github formatting, added Iterating/Loops heading --- README.md | 5 ----- cheat-sheet.md | 7 ++++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d9fea92..ca3455d 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,6 @@ To leave feedback click [here](https://goo.gl/forms/MxDr9q2A4PQV4CRI3) ## How to use -_______________ - - If you are familiar with git, you can clone this repository to your machine and simply start working through files starting from README.md file, after that jump to js/level1.js file. @@ -34,8 +31,6 @@ Follow the instructions in _level1.js_ file and type code in your Text Editor (i ## Structure -____________________ - - CSS folder - contains css files that are responsible for styles and how our project looks on the web. diff --git a/cheat-sheet.md b/cheat-sheet.md index 55bafe6..5442429 100644 --- a/cheat-sheet.md +++ b/cheat-sheet.md @@ -89,13 +89,14 @@ else { } ``` +## Iterating/Loops -## while loop +### while loop It repeats code over and over again until some condition is met. -## for loop +### for loop This loop is similar to ‘while loop’, just with a set amount of repetition. You declare counter in the statement as so: @@ -106,7 +107,7 @@ for (var i = 0; i < 5; i++) { ``` -## infinite loop +### infinite loop A loop that does not stop and it’s a loop that you need to avoid. Each loop should have some condition so it can stop.