aboutsummaryrefslogtreecommitdiff
path: root/files/tr/conflicting/web/javascript/reference/operators
diff options
context:
space:
mode:
Diffstat (limited to 'files/tr/conflicting/web/javascript/reference/operators')
-rw-r--r--files/tr/conflicting/web/javascript/reference/operators/index.html295
1 files changed, 295 insertions, 0 deletions
diff --git a/files/tr/conflicting/web/javascript/reference/operators/index.html b/files/tr/conflicting/web/javascript/reference/operators/index.html
new file mode 100644
index 0000000000..08ec51807a
--- /dev/null
+++ b/files/tr/conflicting/web/javascript/reference/operators/index.html
@@ -0,0 +1,295 @@
+---
+title: Arithmetic operators
+slug: conflicting/Web/JavaScript/Reference/Operators
+tags:
+ - Aritmetik Operatörler
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Operators
+translation_of_original: Web/JavaScript/Reference/Operators/Arithmetic_Operators
+original_slug: Web/JavaScript/Reference/Operatörler/Arithmetic_Operators
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p><strong>Aritmetik operatörler</strong> sayısal değerleri (değişmez değerler veya değişkenler) kendi değişkeni olarak alır ve tek bir sayısal değer döndürür. Standart aritmetik operatörler toplama (+), çıkarma (-), çıkarma (*), ve bölme (/).</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-arithmetic.html")}}</div>
+
+
+
+<h2 id="Addition" name="Addition">Toplama (+)</h2>
+
+<p>Toplama işleci, sayısal değişkenlerin veya dize birleşiminin toplamını üretir.</p>
+
+<h3 id="Syntax">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x + y
+</pre>
+
+<h3 id="Examples">Examples</h3>
+
+<pre class="brush: js">// Number + Number -&gt; Toplama
+1 + 2 // 3
+
+// Boolean + Number -&gt; Toplama
+true + 1 // 2
+
+// Boolean + Boolean -&gt; Toplama
+false + false // 0
+
+// Number + String -&gt; Birleşim
+5 + 'foo' // "5foo"
+
+// String + Boolean -&gt; Birleşim
+'foo' + false // "foofalse"
+
+// String + String -&gt; Birleşim
+'foo' + 'bar' // "foobar"
+</pre>
+
+<h2 id="Subtraction" name="Subtraction">Çıkarma (-)</h2>
+
+<p>Çıkarma işleci (operator), iki değişkeni çıkarır ve farklarını üretir.</p>
+
+<h3 id="Söz_Dizimi">Söz Dizimi</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x - y
+</pre>
+
+<h3 id="Örnekler">Örnekler</h3>
+
+<pre class="brush: js">5 - 3 // 2
+3 - 5 // -2
+'foo' - 3 // NaN(Sayı Değil)</pre>
+
+<h2 id="Division" name="Division">Bölme (/)</h2>
+
+<p>Bölme operatörü, sol değişkenin bölüm olduğu ve sağ değişkenin bölen olduğu işlenenlerin bölümünü üretir.</p>
+
+<h3 id="Söz_Dizimi_2">Söz Dizimi</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x / y
+</pre>
+
+<h3 id="Örnekler_2">Örnekler</h3>
+
+<pre class="brush: js">1 / 2 // 0.5 döndürür
+1 / 2 // Java''da 0 döndürür
+// (her iki sayı da açıkça kayan nokta sayısıdır)
+
+1.0 / 2.0 // JavaScript ve Java 0.5 döndürür
+
+2.0 / 0 // JavaScript sonsuz döndürür
+2.0 / 0.0 // Sonsuzu da döndürür
+2.0 / -0.0 // JavaScript eksi sonsuz da döndürür</pre>
+
+<h2 id="Multiplication" name="Multiplication">Çarpma (*)</h2>
+
+<p>Çarpma operatörü değişkenlerin ürününü üretir.</p>
+
+<h3 id="Söz_Dizimi_3">Söz Dizimi</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x * y
+</pre>
+
+<h3 id="Örnekler_3">Örnekler</h3>
+
+<pre class="brush: js">2 * 2 // 4
+-2 * 2 // -4
+Infinity * 0 // NaN(Sayı Değil1)
+Infinity * Infinity // Sonsuz
+'foo' * 2 // NaN
+</pre>
+
+<h2 id="Remainder" name="Remainder">Kalan (%)</h2>
+
+<p>Kalan operatörü, bir değişken ikinci bir değişken tarafından bölündüğünde kalan döndürür. Her zaman bölüm işareti alır.</p>
+
+<h3 id="Söz_Dizimi_4">Söz Dizimi</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> var1 % var2
+</pre>
+
+<h3 id="Örnekler_4">Örnekler</h3>
+
+<pre class="brush: js">12 % 5 // 2
+-1 % 2 // -1
+1 % -2 // 1
+NaN % 2 // NaN
+1 % 2 // 1
+2 % 3 // 2
+-4 % 2 // -0
+5.5 % 2 // 1.5
+</pre>
+
+<h2 id="Exponentiation" name="Exponentiation">Üs (**)</h2>
+
+<p>The exponentiation operator returns the result of raising first operand to the power second operand. That is, <code>var1</code><sup><code>var2</code></sup>, in the preceding statement, where <code>var1</code> and <code>var2</code> are variables. Exponentiation operator is right associative. <code>a ** b ** c</code> is equal to <code>a ** (b ** c)</code>.</p>
+
+<h3 id="Syntax_2">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> var1 ** var2
+</pre>
+
+<h3 id="Notes">Notes</h3>
+
+<p>In most languages like PHP and Python and others that have an exponentiation operator (**), the exponentiation operator is defined to have a higher precedence than unary operators such as unary + and unary -, but there are a few exceptions. For example, in Bash the ** operator is defined to have a lower precedence than unary operators. In JavaScript, it is impossible to write an ambiguous exponentiation expression, i.e. you cannot put a unary operator (<code>+/-/~/!/delete/void/typeof</code>) immediately before the base number.</p>
+
+<pre class="brush: js">-2 ** 2;
+// 4 in Bash, -4 in other languages.
+// This is invalid in JavaScript, as the operation is ambiguous.
+
+
+-(2 ** 2);
+// -4 in JavaScript and the author's intention is unambiguous.
+</pre>
+
+<h3 id="Examples_2">Examples</h3>
+
+<pre class="brush: js">2 ** 3 // 8
+3 ** 2 // 9
+3 ** 2.5 // 15.588457268119896
+10 ** -1 // 0.1
+NaN ** 2 // NaN
+
+2 ** 3 ** 2 // 512
+2 ** (3 ** 2) // 512
+(2 ** 3) ** 2 // 64
+</pre>
+
+<p>To invert the sign of the result of an exponentiation expression:</p>
+
+<pre class="brush: js">-(2 ** 2) // -4
+</pre>
+
+<p>To force the base of an exponentiation expression to be a negative number:</p>
+
+<pre class="brush: js">(-2) ** 2 // 4
+</pre>
+
+<div class="note">
+<p><strong>Note:</strong> JavaScript also has <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR">a bitwise operator ^ (logical XOR)</a>. <code>**</code> and <code>^</code> are different (for example : <code>2 ** 3 === 8</code> when <code>2 ^ 3 === 1</code>.)</p>
+</div>
+
+<h2 id="Increment" name="Increment">Artırma (++)</h2>
+
+<p>Artış operatörü işlenenini artırır (bir ekler) ve bir değer döndürür.</p>
+
+<ul>
+ <li>İlk önce değişken adı kullanılırsa, değişkenden sonra operatörle (örneğin, x++) kullanılırsa artmadan önce değeri artırır ve döndürür.</li>
+ <li>Ön ek kullanılırsa, değişkenden önce operatörle (örneğin, ++x), daha sonra artırıldıktan sonra değeri artıtrır ve döndürür.</li>
+</ul>
+
+<h3 id="Söz_Dizimi_5">Söz Dizimi</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x++ yada ++x
+</pre>
+
+<h3 id="Örnekler_5">Örnekler</h3>
+
+<pre class="brush: js">// Postfix
+var x = 3;
+y = x++; // y = 3, x = 4
+
+// Prefix
+var a = 2;
+b = ++a; // a = 3, b = 3
+</pre>
+
+<h2 id="Decrement" name="Decrement">Azaltma (--)</h2>
+
+<p>The decrement operator decrements (subtracts one from) its operand and returns a value.</p>
+
+<ul>
+ <li>If used postfix, with operator after operand (for example, x--), then it decrements and returns the value before decrementing.</li>
+ <li>If used prefix, with operator before operand (for example, --x), then it decrements and returns the value after decrementing.</li>
+</ul>
+
+<h3 id="Syntax_3">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x-- or --x
+</pre>
+
+<h3 id="Examples_3">Examples</h3>
+
+<pre class="brush: js">// Postfix
+var x = 3;
+y = x--; // y = 3, x = 2
+
+// Prefix
+var a = 2;
+b = --a; // a = 1, b = 1
+</pre>
+
+<h2 id="Unary_negation" name="Unary_negation">Unary negation (-)</h2>
+
+<p>The unary negation operator precedes its operand and negates it.</p>
+
+<h3 id="Syntax_4">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> -x
+</pre>
+
+<h3 id="Examples_4">Examples</h3>
+
+<pre class="brush: js">var x = 3;
+y = -x; // y = -3, x = 3
+
+// Unary negation operator can convert non-numbers into a number
+var x = "4";
+y = -x; // y = -4
+</pre>
+
+<h2 id="Unary_plus_2"><a name="Unary_plus">Unary plus</a> (+)</h2>
+
+<p>The unary plus operator precedes its operand and evaluates to its operand but attempts to convert it into a number, if it isn't already. Although unary negation (-) also can convert non-numbers, unary plus is the fastest and preferred way of converting something into a number, because it does not perform any other operations on the number. It can convert string representations of integers and floats, as well as the non-string values <code>true</code>, <code>false</code>, and <code>null</code>. Integers in both decimal and hexadecimal ("0x"-prefixed) formats are supported. Negative numbers are supported (though not for hex). If it cannot parse a particular value, it will evaluate to {{jsxref("NaN")}}.</p>
+
+<h3 id="Syntax_5">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> +x
+</pre>
+
+<h3 id="Examples_5">Examples</h3>
+
+<pre class="brush: js">+3 // 3
++'3' // 3
++true // 1
++false // 0
++null // 0
++function(val){ return val } // NaN
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-additive-operators', 'Additive operators')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-postfix-expressions', 'Postfix expressions')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-11.5', 'Multiplicative operators')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-11.4', 'Unary operator')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("javascript.operators.arithmetic")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators">Assignment operators</a></li>
+</ul>