Skip to content

Commit

Permalink
Restructure JavaScript articles (freeCodeCamp#74)
Browse files Browse the repository at this point in the history
* Clean up javascrip Array

* Add missing Array methods

* Organise and add missing Object methods

* Organise and add String methods

* Move certificate articles to 'certificates'

* Stub new articles

* Remove duplicates after rebasing

* Organise JSON articles

* Normalise articles so far

* Add Number, Error, Generator and Function articles

* Group standard object together

* Add ArrayBuffer, Atomics, Boolean, Math and Promise to stadard-objects

* Stub new articles

* Alphabetise preformatted list

* Fix Javascript formatting

* Add stats to _createNavData.js

* Small change to trigger netlify build
  • Loading branch information
Bouncey authored and QuincyLarson committed Jul 24, 2017
1 parent 44dc52e commit fad7aa5
Show file tree
Hide file tree
Showing 470 changed files with 4,327 additions and 1,583 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ The Hemingway App will assign a “grade level” for your writing. You should a
Also, there's a community of support from a whole team of contributors, whom you can bounce ideas off of and ask for input on your writing. Stay active in the [contributors chat room](https://gitter.im/freecodecamp/contributors) and ask lots of questions.

With your help, we can create a comprehensive reference tool that will help millions of people who are learning to code for years to come.

10 changes: 9 additions & 1 deletion seed/_createNavData.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function listAllDirs(level, prevPages = []) {
});
}
module.exports = function createNavData() {
const startTime = Date.now();
listAllDirs(topLevel, [])
.toArray()
.subscribe(
Expand All @@ -54,7 +55,14 @@ module.exports = function createNavData() {
JSON.stringify(navData, null, 2)
)
.then(() => {
console.log('\nnavData.json created\n');
const endTime = Date.now();
const pages = Object.keys(navData).length;
console.log(`
navData created
It took ${endTime - startTime}ms to create the nav data for ${pages} pages
`
);
})
.catch(err => {
console.error(err);
Expand Down
155 changes: 118 additions & 37 deletions seed/utils/formatting.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,141 @@
/* eslint-disable camelcase */
const preFormatted = {
arraybuffer: 'ArrayBuffer',
aws: 'AWS',
bytelength: 'byteLength',
charat: 'charAt',
charcodeat: 'charCodeAt',
codepointat: 'codePointAt',
columnnumber: 'columnNumber',
compareexchange: 'compareExchange',
copywithin: 'copyWithin',
css: 'CSS',
css3: 'CSS3',
defineproperties: 'defineProperties',
defineproperty: 'defineProperty',
deleteproperty: 'deleteProperty',
displayname: 'displayName',
dynamodb: 'DynamoDB',
e: 'E',
endswith: 'endsWith',
epsilon: 'EPSILON',
filename: 'fileName',
findindex: 'findIndex',
foreach: 'forEach',
fromcharcode: 'fromCharCode',
frompointcode: 'fromPointCode',
getdate: 'getDate',
getday: 'getDay',
getfullyear: 'getFullYear',
gethours: 'getHours',
getmilliseconds: 'getMilliseconds',
getminutes: 'getMinutes',
getmonth: 'getMonth',
getownpropertydescriptor: 'getOwnPropertyDescriptor',
getownpropertydescriptors: 'getOwnPropertyDescriptors',
getownpropertynames: 'getOwnPropertyNames',
getownpropertysymbols: 'getOwnPropertySymbols',
getprototypeof: 'getPrototypeOf',
getseconds: 'getSeconds',
gettime: 'getTime',
getomezoneoffset: 'getTimezoneOffset',
getutcdate: 'getUTCDate',
getutcday: 'getUTCDay',
getutcfullyear: 'getUTCFullYear',
getutchours: 'getUTCHours',
getutcmilliseconds: 'getUTCMilliseconds',
getutcminutes: 'getUTCMinutes',
getutcmonth: 'getUTCMonth',
getutcseconds: 'getUTCSeconds',
getyear: 'getYear',
hasownproperty: 'hasOwnProperty',
html: 'HTML',
html5: 'HTML5',
javascript: 'javaScript',
indexof: 'indexOf',
ignorecase: 'ignoreCase',
isarray: 'isArray',
isealed: 'isSealed',
isextensible: 'isExtensible',
isfinite: 'isFinite',
isfrozen: 'isFrozen',
isgenerator: 'isGenerator',
isinteger: 'isInteger',
islockfree: 'isLockFree',
isnan: 'isNaN',
issafeinteger: 'isSafeInteger',
isview: 'isView',
javascript: 'JavaScript',
jquery: 'jQuery',
sql: 'SQL',
aws: 'AWS',
mongodb: 'MongoDB',
dynamodb: 'DynamoDB',
json: 'JSON',
foreach: 'forEach',
indexof: 'indexOf',
copywithin: 'copyWithin',
findindex: 'findIndex',
lastindexof: 'lastIndexOf',
reduceright: 'reduceRight',
tolocalstring: 'toLocalString',
tolowercase: 'toLowerCase',
touppercase: 'toUpperCase',
tosource: 'toSource',
tosrting: 'toString',
fromcharcode: 'fromCharCode',
frompointcode: 'fromPointCode',
charat: 'charAt',
charcodeat: 'charCodeAt',
codepointat: 'codePointAt',
endswith: 'endsWith',
linenumber: 'lineNumber',
ln2: 'LN2',
ln10: 'LN10',
localcompare: 'localCompare',
log2e: 'LOG2E',
log10e: 'LOG10E',
max_safe_integer: 'MAX_SAFE_INTEGER',
max_value: 'MAX_VALUE',
min_safe_integer: 'MIN_SAFE_INTEGER',
min_value: 'MIN_VALUE',
mongodb: 'MongoDB',
nan: 'NaN',
negative_infinity: 'NEGATIVE_INFINITY',
padend: 'padEnd',
padstart: 'padStart',
parsefloat: 'parseFloat',
parseint: 'parseInt',
pi: 'PI',
positive_infinity: 'POSITIVE_INFINITY',
preventextentions: 'preventExtensions',
propertyisenumerable: 'propertyIsEnumerable',
reduceright: 'reduceRight',
regexp: 'RegExp',
setdate: 'setDate',
setfullyear: 'setFullYear',
sethours: 'setHours',
setmilliseconds: 'setMilliseconds',
setminutes: 'setMinutes',
setmonth: 'setMonth',
setprototypeof: 'setPrototypeOf',
setseconds: 'setSeconds',
settime: 'setTime',
setutcdate: 'setUTCDate',
setutcfullyear: 'setUTCFullYear',
setutchours: 'setUTCHours',
setutcmilliseconds: 'setUTCMilliseconds',
setutcminutes: 'setUTCMinutes',
setutcmonth: 'setUTCMonth',
setutcseconds: 'setUTCSeconds',
setyear: 'setYear',
sql: 'SQL',
sqrt1_2: 'SQRT1_2',
sqrt2: 'SQRT2',
startswith: 'startsWith',
todatestring: 'toDateString',
toexponential: 'toExponential',
tofixed: 'toFixed',
toisostring: 'toISOString',
tojson: 'toJSON',
tolocaledatestring: 'toLocaleDateString',
tolocalelowercase: 'toLocaleLowerCase',
tolocalestring: 'toLocaleString',
tolocaletimestring: 'toLocaleTimeString',
tolocaleuppercase: 'toLocaleUpperCase',
tolowercase: 'toLowerCase',
toprecision: 'toPrecision',
tosource: 'toSource',
tostring: 'toString',
totimestring: 'toTimeString',
touppercase: 'toUpperCase',
toutcstring: 'toUTCString',
trimleft: 'trimLeft',
trimRight: 'trimRight',
valueof: 'valueOf',
getownpropertydescriptor: 'getOwnPropertyDescriptor',
getownpropertydescriptors: 'getOwnPropertyDescriptors',
getownpropertynames: 'getOwnPropertyNames',
getownpropertysymbols: 'getOwnPropertySymbols',
preventextentions: 'preventExtensions',
defineproperties: 'defineProperties',
defineproperty: 'defineProperty',
getprototypeof: 'getPrototypeOf',
setprototypeof: 'setPrototypeOf',
isarray: 'isArray',
isextensible: 'isExtensible',
isfrozen: 'isFrozen',
isealed: 'isSealed',
__definegetter__: '__defineGetter__',
__definesetter__: '__defineSetter__',
hasownproperty: 'hasOwnProperty',
__lookupgetter__: '__lookupGetter__',
__lookupsetter__: '__lookupSetter__',
propertyisenumerable: 'propertyIsEnumerable'
__lookupsetter__: '__lookupSetter__'
};

const stopWords = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Add Your javaScript Slot Machine Slots
title: Add Your JavaScript Slot Machine Slots
---
For this part we should notify if they same number is returned three times or return `null` otherwise.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Bring Your javaScript Slot Machine to Life
title: Bring Your JavaScript Slot Machine to Life
---
Let's use the jQuery selector `$(".slot")` to select all of the slots.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Add New Properties to a javaScript Object
title: Add New Properties to a JavaScript Object
---
You can add new properties to existing JavaScript objects the same way you would modify them. Here is how:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Add Two Numbers with javaScript
title: Add Two Numbers with JavaScript
---
JavaScript uses the `+` symbol for addition. It can also be used instead of `parseInt()` but that is beyond this.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Advantages and Disadvantages of javaScript
title: Advantages and Disadvantages of JavaScript
---
Like all computer languages, JavaScript has certain advantages and disadvantages. Many of the pros and cons are related to being a client-side language.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Arithmetic Operation javaScript
title: Arithmetic Operation JavaScript
---
JavaScript provides the user with five arithmetic operators: `+`, `-`, `*`, `/` and `%`. The operators are for addition, subtraction, multiplication, division and remainder respectively.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Build javaScript Objects
title: Build JavaScript Objects
---
Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Code Linting in javaScript
title: Code Linting in JavaScript
---
Linting is the process of running a program that analyzes your code for programmatic and stylistic errors. A linting tool, or a linter, marks or flags any potential errors in your code such as syntax errors or incorrectly spelled variable names. This can save time and help you write better code.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Comment Your javaScript Code
title: Comment Your JavaScript Code
---
Comments are a great way to leave notes to yourself and to other people who will later need to figure out what it does. Any code in it will be ignored.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Construct javaScript Objects with Functions
title: Construct JavaScript Objects with Functions
---
Using constructors it is easy to create new objects using a blueprint or constructor. The declaration syntax is a little different but still easy to remember.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Create a javaScript Slot Machine
title: Create a JavaScript Slot Machine
---
For this we have to generate three random numbers using the formula they give us and not the general one. `Math.floor(Math.random() * (3 - 1 + 1)) + 1;`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Create Decimal Numbers with javaScript
title: Create Decimal Numbers with JavaScript
---
JavaScript number variables can have decimals.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Debugging javaScript with Browser Devtools
title: Debugging JavaScript with Browser Devtools
---
As a developer you will often want to debug code. You might have already used `console.log` in some of the challenges, which is the simplest way to debug.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Declare javaScript Objects as Variables
title: Declare JavaScript Objects as Variables
---
This has a simple format. You declare your variable and have it equal to an object in the form `{ key: value}`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Declare javaScript Variables
title: Declare JavaScript Variables
---
When we store data in a data structure, we call it a variable. JavaScript variables are written in `camel case`. An example of camel case is: `camelCase`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Decrement a Number with javaScript
title: Decrement a Number with JavaScript
---
You can easily decrement or decrease a variable by `1` with the `--` operator.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Delete Properties from a javaScript Object
title: Delete Properties from a JavaScript Object
---
We can also delete properties from objects like this:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Divide One Number by Another with javaScript
title: Divide One Number by Another with JavaScript
---
JavaScript uses use the `/` symbol for division.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Finding a Remainder in javaScript
title: Finding a Remainder in JavaScript
---
The _remainder operator_ `%` gives the remainder of the division of two numbers.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Generate Random Fractions with javaScript
title: Generate Random Fractions with JavaScript
---
JavaScript has a `Math.random()` function that generates a random decimal number.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Generate Random Whole Numbers with javaScript
title: Generate Random Whole Numbers with JavaScript
---
It's great that we can create random decimal numbers, but it's even more useful if we lot more useful to generate a random whole number.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Get Current Url in javaScript
title: Get Current Url in JavaScript
---
To get the **current URL**:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Give Your javaScript Slot Machine Some Stylish Images
title: Give Your JavaScript Slot Machine Some Stylish Images
---
We've already set up the images for you in an array called images. We can use different indexes to grab each of these.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: How to Create a Dropdown Menu with CSS and javaScript
title: How to Create a Dropdown Menu with CSS and JavaScript
---
## How to Create a Dropdown Menu with CSS and javaScript
## How to Create a Dropdown Menu with CSS and JavaScript

This is a stub. [Help our community expand it](https://github.com/freecodecamp/guides/tree/master/src/pages/articles/javascript/how-to-create-a-dropdown-menu-with-css-and-javascript/index.md).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Increment a Number with javaScript
title: Increment a Number with JavaScript
---
You can easily increment or add `1` to a variable with the `++` operator.

Expand Down
4 changes: 2 additions & 2 deletions src/pages/articles/javascript/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: javaScript
title: JavaScript
---
## javaScript
## JavaScript

This is a stub. [Help our community expand it](https://github.com/freecodecamp/guides/tree/master/src/pages/articles/javascript/index.md).

Expand Down
Loading

0 comments on commit fad7aa5

Please sign in to comment.