From fb61130aa3c78d19e7568f1368d91f7c7455b808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darlan=20Mendon=C3=A7a?= Date: Thu, 13 Oct 2016 11:29:04 -0300 Subject: [PATCH 1/2] add article number --- README.md | 3 +- content/en/number.md | 61 +++++++++++++++++++++++++++++++++++++++++ content/pt-br/number.md | 60 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 content/en/number.md create mode 100644 content/pt-br/number.md diff --git a/README.md b/README.md index 4242a29..ce4e322 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,5 @@ If you are a beginner in javascript, or know it, below you can find articles to - ECMAScript [en](content/en/ecma-script.md), [pt-br](content/pt-br/ecma-script.md) - var [en](content/en/var.md), [pt-br](content/pt-br/var.md) -- string [en](content/en/string.md), [pt-br](content/pt-br/string.md) +- String [en](content/en/string.md), [pt-br](content/pt-br/string.md) +- Number [en](content/en/number.md), [pt-br](content/pt-br/number.md) diff --git a/content/en/number.md b/content/en/number.md new file mode 100644 index 0000000..9aa51e2 --- /dev/null +++ b/content/en/number.md @@ -0,0 +1,61 @@ +## Number + +Another variable type in Javascript is the type Number. + +Is very common in other languages have two or more types to numbers, + +É comum em outras linguagens termos dois ou mais tipos para números, it is typically a Type integer, and other of type float. sendo normalmente um do tipo inteiro, e outro de tipo flutuante. + +``` +// Examples of integers: +5 +10 +22 +``` + +``` +// and floats +10.5 +0.5 +3.3232 +102.20 +``` + +However in Javascript, integer numbers or floats be +Porém em Javascript, integers and floating numbers are actually the same type of variable, Number. We will see later methods to allow us treat these numbers with the precision we desire. + +For now, to create a variable of type Number in Javascript, just assign a value, different of Strings, dont be necessary any special symbol, e.g: + +```js +var averageSizeDragon = 68.5; +var amountDragons = 3; +``` + +We will see more operators in other article, but if you want to advance, below we use some simple operators, to sum, subtract, divide and multiply: + +```js +// soma +10 + 10 +amountDragons + 1 +``` + +Não se esqueça de testar usando o `console.log`. + +```js +// subtração +10 - 5 +amountDragons - 2 +``` + +```js +// multiplicação +10 * 10 +amountDragons * averageSizeDragon +``` + +```js +// divisão +32 / 3 +32 / 2 +amountDragons / averageSizeDragon +``` \ No newline at end of file diff --git a/content/pt-br/number.md b/content/pt-br/number.md new file mode 100644 index 0000000..f585e98 --- /dev/null +++ b/content/pt-br/number.md @@ -0,0 +1,60 @@ +## Number + +Um outro tipo de varíavel existente em Javascript é o tipo Number. + +É comum em outras linguagens termos dois ou mais tipos para números, sendo normalmente um do tipo inteiro, e outro de tipo flutuante. + +```js +// exemplos de números inteiros +5 +10 +22 +``` + + + +```js +// e de tipos flutuantes +10.5 +0.5 +3.3232 +102.20 +``` + +Porém em Javascript, números inteiros ou flutuantes são na verdade um mesmo tipo de variável, Number. Posteriormente veremos métodos que nos permitirá tratar estes números com a precisão que desejarmos. + +Por hora, para criar uma variável do tipo Number em Javascript, simplesmente atribua o valor, diferente de Strings, não é necessário nenhum símbolo especial. Exemplo: + +```js +var averageSizeDragon = 68.5; +var amountDragons = 3; +``` + +Veremos mais operadores em outro artigo, mas se quiser adiantar, abaixo usamos alguns operadores simples, para soma, subtração, divisão e multiplicação: + +```js +// soma +10 + 10 +amountDragons + 1 +``` + +Não se esqueça de testar usando o `console.log`. + +```js +// subtração +10 - 5 +amountDragons - 2 +``` + +```js +// multiplicação +10 * 10 +amountDragons * averageSizeDragon +``` + +```js +// divisão +32 / 3 +32 / 2 +amountDragons / averageSizeDragon +``` \ No newline at end of file From 0aedc9bd7a18aac904286d003c2428e2f694eadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darlan=20Mendon=C3=A7a?= Date: Fri, 14 Oct 2016 10:39:04 -0300 Subject: [PATCH 2/2] remove pt from en/number.md --- content/en/number.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/content/en/number.md b/content/en/number.md index 9aa51e2..fe4f0c2 100644 --- a/content/en/number.md +++ b/content/en/number.md @@ -2,9 +2,7 @@ Another variable type in Javascript is the type Number. -Is very common in other languages have two or more types to numbers, - -É comum em outras linguagens termos dois ou mais tipos para números, it is typically a Type integer, and other of type float. sendo normalmente um do tipo inteiro, e outro de tipo flutuante. +Is very common in other languages have two or more types to numbers, it is typically a Type integer, and other of type float. sendo normalmente um do tipo inteiro, e outro de tipo flutuante. ``` // Examples of integers: @@ -21,8 +19,7 @@ Is very common in other languages have two or more types to numbers, 102.20 ``` -However in Javascript, integer numbers or floats be -Porém em Javascript, integers and floating numbers are actually the same type of variable, Number. We will see later methods to allow us treat these numbers with the precision we desire. +However in Javascript, integer numbers or floats and floating numbers are actually the same type of variable, Number. We will see later methods to allow us treat these numbers with the precision we desire. For now, to create a variable of type Number in Javascript, just assign a value, different of Strings, dont be necessary any special symbol, e.g: @@ -39,22 +36,22 @@ We will see more operators in other article, but if you want to advance, below w amountDragons + 1 ``` -Não se esqueça de testar usando o `console.log`. +Dont forget to test using the `console.log`. ```js -// subtração +// subtraction 10 - 5 amountDragons - 2 ``` ```js -// multiplicação +// multiplication 10 * 10 amountDragons * averageSizeDragon ``` ```js -// divisão +// division 32 / 3 32 / 2 amountDragons / averageSizeDragon