From 54d303ce1f5a64f9fdbec189e299153fb28b873c Mon Sep 17 00:00:00 2001 From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Date: Thu, 20 Jun 2019 13:42:13 -0700 Subject: [PATCH] fix: converted single to triple backticks11 (#36238) --- .../map/map-prototype-size/index.md | 22 +- .../map/map-prototype-values/index.md | 28 +- .../javascript/standard-objects/math/index.md | 11 +- .../standard-objects/math/math-ceil/index.md | 11 +- .../standard-objects/math/math-floor/index.md | 13 +- .../standard-objects/math/math-max/index.md | 33 ++- .../standard-objects/math/math-min/index.md | 7 +- .../standard-objects/math/math-pi/index.md | 5 +- .../standard-objects/math/math-pow/index.md | 13 +- .../math/math-random/index.md | 9 +- .../standard-objects/math/math-sqrt/index.md | 13 +- .../standard-objects/math/math-trunc/index.md | 13 +- .../number/number-isinteger/index.md | 39 +-- .../object/object-assign/index.md | 50 ++-- .../object/object-destructuring/index.md | 259 +++++++++--------- .../object/object-freeze/index.md | 64 ++--- .../object/object-isfrozen/index.md | 32 ++- .../object-prototype-hasownproperty/index.md | 31 ++- .../promise/promise-reject/index.md | 21 +- .../promise/promise-resolve/index.md | 49 ++-- .../regexp/regexp-prototype-test/index.md | 38 +-- .../string/string-prototype-endswith/index.md | 18 +- .../string/string-prototype-includes/index.md | 50 ++-- .../string/string-prototype-indexof/index.md | 28 +- .../string/string-prototype-split/index.md | 32 ++- .../string/string-prototype-substr/index.md | 12 +- .../string-prototype-substring/index.md | 20 +- .../string/string-prototype-trim/index.md | 7 +- guide/arabic/javascript/strict-mode/index.md | 53 ++-- .../javascript/switch-statements/index.md | 100 +++---- .../javascript/ternary-operator/index.md | 14 +- .../arabic/javascript/this-reference/index.md | 175 ++++++------ .../arabic/javascript/timing-events/index.md | 71 ++--- .../index.md | 12 +- .../comment-your-javascript-code/index.md | 13 +- .../index.md | 10 +- .../index.md | 17 +- .../index.md | 11 +- .../detect-authentic-click-events/index.md | 27 +- .../how-to-create-a-slideshow/index.md | 9 +- .../tutorials/how-to-create-popups/index.md | 12 +- .../page-redirects-using-javascript/index.md | 47 ++-- .../what-does-javascript-void-0-mean/index.md | 58 ++-- guide/arabic/javascript/typeof/index.md | 94 ++++--- guide/arabic/javascript/where-to/index.md | 53 ++-- .../javascript/window-confirm-method/index.md | 9 +- .../javascript/window-localstorage/index.md | 25 +- .../javascript/window-open-method/index.md | 15 +- .../window-settimeout-method/index.md | 48 ++-- guide/arabic/javascript/with/index.md | 65 +++-- guide/arabic/jquery/index.md | 13 +- .../jquery/jquery-ajax-get-method/index.md | 5 +- .../jquery/jquery-ajax-post-method/index.md | 37 +-- guide/arabic/jquery/jquery-animate/index.md | 5 +- .../jquery/jquery-click-method/index.md | 82 +++--- .../jquery-effects-hide-method/index.md | 21 +- .../jquery-effects-show-method/index.md | 10 +- .../jquery/jquery-hover-method/index.md | 5 +- guide/arabic/jquery/jquery-selectors/index.md | 104 +++---- guide/arabic/kotlin/hello-world/index.md | 41 +-- guide/arabic/kotlin/index.md | 158 +++++------ guide/arabic/kotlin/strings/index.md | 222 ++++++++------- .../create-file-with-sepcific-size/index.md | 10 +- guide/arabic/linux/getting-started/index.md | 10 +- .../index.md | 21 +- .../how-to-download-files-with-wget/index.md | 30 +- .../index.md | 40 +-- .../index.md | 31 ++- guide/arabic/linux/shell-scripting/index.md | 33 ++- .../index.md | 5 +- .../arabic/linux/the-command-prompt/index.md | 79 +++--- .../linux/user-management-on-linux/index.md | 47 ++-- .../linux/writing-a-bash-script/index.md | 59 ++-- .../clustering-algorithms/index.md | 77 +++--- .../linear-regression/index.md | 92 ++++--- 75 files changed, 1673 insertions(+), 1430 deletions(-) diff --git a/guide/arabic/javascript/standard-objects/map/map-prototype-size/index.md b/guide/arabic/javascript/standard-objects/map/map-prototype-size/index.md index 738cfd9609..8130af650a 100644 --- a/guide/arabic/javascript/standard-objects/map/map-prototype-size/index.md +++ b/guide/arabic/javascript/standard-objects/map/map-prototype-size/index.md @@ -8,16 +8,18 @@ localeTitle: Map.prototype.size ## بناء الجملة - `myMap.size(); -` +```javascript +myMap.size(); +``` ## مثال - `const myMap = new Map(); - myMap.set('foo',1); - myMap.set('bar',2); - myMap.set('baz',3); - - - myMap.size(); // 3 -` \ No newline at end of file +```javascript +const myMap = new Map(); +myMap.set('foo',1); +myMap.set('bar',2); +myMap.set('baz',3); + + +myMap.size(); // 3 +``` \ No newline at end of file diff --git a/guide/arabic/javascript/standard-objects/map/map-prototype-values/index.md b/guide/arabic/javascript/standard-objects/map/map-prototype-values/index.md index 7531078418..0a9727150d 100644 --- a/guide/arabic/javascript/standard-objects/map/map-prototype-values/index.md +++ b/guide/arabic/javascript/standard-objects/map/map-prototype-values/index.md @@ -8,19 +8,21 @@ localeTitle: Map.prototype.values ## بناء الجملة - `myMap.values() -` +```javascript +myMap.values() +``` ## مثال - `const myMap = new Map(); - myMap.set('foo',1); - myMap.set('bar',2); - myMap.set('baz',3); - - - const iterator = myMap.values(); - console.log(iterator.next().value); // 1 - console.log(iterator.next().value); // 2 - console.log(iterator.next().value); // 3 -` \ No newline at end of file +```javascript +const myMap = new Map(); +myMap.set('foo',1); +myMap.set('bar',2); +myMap.set('baz',3); + + +const iterator = myMap.values(); +console.log(iterator.next().value); // 1 +console.log(iterator.next().value); // 2 +console.log(iterator.next().value); // 3 +``` \ No newline at end of file diff --git a/guide/arabic/javascript/standard-objects/math/index.md b/guide/arabic/javascript/standard-objects/math/index.md index 949b701bb1..d8947e5483 100644 --- a/guide/arabic/javascript/standard-objects/math/index.md +++ b/guide/arabic/javascript/standard-objects/math/index.md @@ -10,11 +10,12 @@ localeTitle: الرياضيات يوضح المثال التالي كيفية استخدام كائن `Math` لكتابة دالة تقوم بحساب مساحة دائرة: - `function calculateCircleArea(radius) { - return Math.PI * Math.pow(radius, 2); - } - calculateCircleArea(1); // 3.141592653589793 -` +```javascript +function calculateCircleArea(radius) { + return Math.PI * Math.pow(radius, 2); +} +calculateCircleArea(1); // 3.141592653589793 +``` ### موارد آخرى diff --git a/guide/arabic/javascript/standard-objects/math/math-ceil/index.md b/guide/arabic/javascript/standard-objects/math/math-ceil/index.md index fdce9dc7d4..ad44cb3272 100644 --- a/guide/arabic/javascript/standard-objects/math/math-ceil/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-ceil/index.md @@ -8,11 +8,12 @@ localeTitle: الرياضيات Ceil ### أمثلة - `Math.ceil(0.1) // 1 - Math.ceil(1.3) // 2 - Math.ceil(-0.9) // -0 - Math.ceil(-1.5) // -1 -` +```javascript +Math.ceil(0.1) // 1 +Math.ceil(1.3) // 2 +Math.ceil(-0.9) // -0 +Math.ceil(-1.5) // -1 +``` ### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-floor/index.md b/guide/arabic/javascript/standard-objects/math/math-floor/index.md index 0364ec6499..8f6d4e3bff 100644 --- a/guide/arabic/javascript/standard-objects/math/math-floor/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-floor/index.md @@ -8,12 +8,13 @@ localeTitle: الطابق الرياضيات ### أمثلة - `Math.floor(0.9) // 0 - Math.floor(1.3) // 1 - Math.floor(0.5) // 0 - Math.floor(-0.9) // -1 - Math.floor(-1.3) // -2 -` +```javascript +Math.floor(0.9) // 0 +Math.floor(1.3) // 1 +Math.floor(0.5) // 0 +Math.floor(-0.9) // -1 +Math.floor(-1.3) // -2 +``` ### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-max/index.md b/guide/arabic/javascript/standard-objects/math/math-max/index.md index 5140c8662e..cb2ee4099d 100644 --- a/guide/arabic/javascript/standard-objects/math/math-max/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-max/index.md @@ -10,8 +10,9 @@ localeTitle: الرياضيات ماكس ### بناء الجملة - `Math.max(value1, value2, value3, ...); -` +```js +Math.max(value1, value2, value3, ...); +``` ### المعلمات @@ -25,27 +26,31 @@ localeTitle: الرياضيات ماكس _الأرقام كمعلمات_ - `Math.max(4, 13, 27, 0, -5); // returns 27 -` +```js +Math.max(4, 13, 27, 0, -5); // returns 27 +``` _معلمة غير صالحة_ - `Math.max(4, 13, 27, 'eight', -5); // returns NaN -` +```js +Math.max(4, 13, 27, 'eight', -5); // returns NaN +``` _صفيف كمعلمة ، استخدام السبريد (…)_ - `let numbers = [4, 13, 27, 0, -5]; - - Math.max(...numbers); // returns 27 -` +```js +let numbers = [4, 13, 27, 0, -5]; + +Math.max(...numbers); // returns 27 +``` _صفيف كمعلمة ، باستخدام تطبيق_ - `let numbers = [4, 13, 27, 0, -5]; - - Math.max.apply(null, numbers); // returns 27 -` +```js +let numbers = [4, 13, 27, 0, -5]; + +Math.max.apply(null, numbers); // returns 27 +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-min/index.md b/guide/arabic/javascript/standard-objects/math/math-min/index.md index 55108eb417..86b3c79dca 100644 --- a/guide/arabic/javascript/standard-objects/math/math-min/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-min/index.md @@ -8,9 +8,10 @@ localeTitle: الرياضيات مين يمكنك تمرير أي عدد من الحجج. - `Math.min(7, 2, 9, -6); - // returns -6 -` +```javascript +Math.min(7, 2, 9, -6); +// returns -6 +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-pi/index.md b/guide/arabic/javascript/standard-objects/math/math-pi/index.md index 50bf97643f..99b2332204 100644 --- a/guide/arabic/javascript/standard-objects/math/math-pi/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-pi/index.md @@ -10,8 +10,9 @@ localeTitle: الرياضيات PI ## أمثلة - `Math.PI \\ 3.141592653589793 -` +```js +Math.PI \\ 3.141592653589793 +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-pow/index.md b/guide/arabic/javascript/standard-objects/math/math-pow/index.md index 3be2f66162..c21c1b0153 100644 --- a/guide/arabic/javascript/standard-objects/math/math-pow/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-pow/index.md @@ -14,12 +14,13 @@ localeTitle: الرياضيات الأسرى #### أمثلة - `Math.pow(5, 2); // 25 - Math.pow(7, 4); // 2401 - Math.pow(9, 0.5); // 3 - Math.pow(-8, 2); // 64 - Math.pow(-4, 3); // -64 -` +```js +Math.pow(5, 2); // 25 +Math.pow(7, 4); // 2401 +Math.pow(9, 0.5); // 3 +Math.pow(-8, 2); // 64 +Math.pow(-4, 3); // -64 +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-random/index.md b/guide/arabic/javascript/standard-objects/math/math-random/index.md index a53d55d8a8..a4d8ef3de5 100644 --- a/guide/arabic/javascript/standard-objects/math/math-random/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-random/index.md @@ -12,10 +12,11 @@ localeTitle: الرياضيات عشوائي #### مثال - `function randomInRange(min, max) { - return Math.random() * (max - min) + min; - } -` +```js +function randomInRange(min, max) { + return Math.random() * (max - min) + min; +} +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-sqrt/index.md b/guide/arabic/javascript/standard-objects/math/math-sqrt/index.md index 7598434d74..7140511e06 100644 --- a/guide/arabic/javascript/standard-objects/math/math-sqrt/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-sqrt/index.md @@ -16,12 +16,13 @@ localeTitle: الرياضيات Sqrt #### أمثلة - `Math.sqrt(25); // 5 - Math.sqrt(169); // 13 - Math.sqrt(3); // 1.732050807568 - Math.sqrt(1); // 1 - Math.sqrt(-5); // NaN -` +```js +Math.sqrt(25); // 5 +Math.sqrt(169); // 13 +Math.sqrt(3); // 1.732050807568 +Math.sqrt(1); // 1 +Math.sqrt(-5); // NaN +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/math/math-trunc/index.md b/guide/arabic/javascript/standard-objects/math/math-trunc/index.md index 4fcdcc7d5d..ce27000954 100644 --- a/guide/arabic/javascript/standard-objects/math/math-trunc/index.md +++ b/guide/arabic/javascript/standard-objects/math/math-trunc/index.md @@ -10,12 +10,13 @@ localeTitle: Math Trunc ### أمثلة - `Math.trunc(0.1) // 0 - Math.trunc(1.3) // 1 - Math.trunc(-0.9) // -0 - Math.trunc(-1.5) // -1 - Math.trunc('foo') // NaN -` +```javascript +Math.trunc(0.1) // 0 +Math.trunc(1.3) // 1 +Math.trunc(-0.9) // -0 +Math.trunc(-1.5) // -1 +Math.trunc('foo') // NaN +``` ### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/number/number-isinteger/index.md b/guide/arabic/javascript/standard-objects/number/number-isinteger/index.md index a93d08138e..9d7e9a0ad8 100644 --- a/guide/arabic/javascript/standard-objects/number/number-isinteger/index.md +++ b/guide/arabic/javascript/standard-objects/number/number-isinteger/index.md @@ -26,25 +26,26 @@ A [Boolean](https://guide.freecodecamp.org/javascript/booleans) تشير إلى ## أمثلة - `Number.isInteger(0); // true - Number.isInteger(-0); // true - Number.isInteger(1); // true - Number.isInteger(2); // true - Number.isInteger(-100001); // true - Number.isInteger(999999999999999999999999); // true - - Number.isInteger(0.1); // false - Number.isInteger(0.3); // false - Number.isInteger(Math.PI); // false - - Number.isInteger(NaN); // false - Number.isInteger(Infinity); // false - Number.isInteger(-Infinity); // false - Number.isInteger('10'); // false - Number.isInteger(true); // false - Number.isInteger(false); // false - Number.isInteger([1]); // false -` +``` +Number.isInteger(0); // true +Number.isInteger(-0); // true +Number.isInteger(1); // true +Number.isInteger(2); // true +Number.isInteger(-100001); // true +Number.isInteger(999999999999999999999999); // true + +Number.isInteger(0.1); // false +Number.isInteger(0.3); // false +Number.isInteger(Math.PI); // false + +Number.isInteger(NaN); // false +Number.isInteger(Infinity); // false +Number.isInteger(-Infinity); // false +Number.isInteger('10'); // false +Number.isInteger(true); // false +Number.isInteger(false); // false +Number.isInteger([1]); // false +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/object/object-assign/index.md b/guide/arabic/javascript/standard-objects/object/object-assign/index.md index 67eb28d468..59a8a7d277 100644 --- a/guide/arabic/javascript/standard-objects/object/object-assign/index.md +++ b/guide/arabic/javascript/standard-objects/object/object-assign/index.md @@ -16,8 +16,9 @@ localeTitle: كائن التعيين **بناء الجملة** - `Object.assign(targetObject, ...sourceObject) -` +```javascript +Object.assign(targetObject, ...sourceObject) +``` **قيمة الإرجاع** @@ -27,33 +28,36 @@ localeTitle: كائن التعيين _تعديل ونسخ targetObject_ - `let obj = {name: 'Dave', age: 30}; - - let objCopy = Object.assign(obj, {coder: true}); - - console.log(obj); // returns { name: 'Dave', age: 30, coder: true } - console.log(objCopy); // returns { name: 'Dave', age: 30, coder: true } -` +```javascript +let obj = {name: 'Dave', age: 30}; + +let objCopy = Object.assign(obj, {coder: true}); + +console.log(obj); // returns { name: 'Dave', age: 30, coder: true } +console.log(objCopy); // returns { name: 'Dave', age: 30, coder: true } +``` _نسخ targetObject بدون تعديل_ - `let obj = {name: 'Dave', age: 30}; - - let objCopy = Object.assign({}, obj, {coder: true}); - - console.log(obj); // returns { name: 'Dave', age: 30 } - console.log(objCopy); // returns { name: 'Dave', age: 30, coder: true } -` +```javascript +let obj = {name: 'Dave', age: 30}; + +let objCopy = Object.assign({}, obj, {coder: true}); + +console.log(obj); // returns { name: 'Dave', age: 30 } +console.log(objCopy); // returns { name: 'Dave', age: 30, coder: true } +``` _كائنات ذات خصائص مماثلة_ - `let obj = {name: 'Dave', age: 30, favoriteColor: 'blue'}; - - let objCopy = Object.assign({}, obj, {coder: true, favoriteColor: 'red'}); - - console.log(obj); // returns { name: 'Dave', age: 30, favoriteColor: 'blue' } - console.log(objCopy); // { name: 'Dave', age: 30, favoriteColor: 'red', coder: true } -` +```javascript +let obj = {name: 'Dave', age: 30, favoriteColor: 'blue'}; + +let objCopy = Object.assign({}, obj, {coder: true, favoriteColor: 'red'}); + +console.log(obj); // returns { name: 'Dave', age: 30, favoriteColor: 'blue' } +console.log(objCopy); // { name: 'Dave', age: 30, favoriteColor: 'red', coder: true } +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/object/object-destructuring/index.md b/guide/arabic/javascript/standard-objects/object/object-destructuring/index.md index ce4430270f..fa00b0a6b5 100644 --- a/guide/arabic/javascript/standard-objects/object/object-destructuring/index.md +++ b/guide/arabic/javascript/standard-objects/object/object-destructuring/index.md @@ -10,21 +10,23 @@ localeTitle: Object Destructuring ### الواجب الأساسي - `var userInfo = {name: 'neel', age: 22}; - var {name, age} = userInfo; - - console.log(name); // neel - console.log(age); // 22 -` +``` +var userInfo = {name: 'neel', age: 22}; +var {name, age} = userInfo; + +console.log(name); // neel +console.log(age); // 22 +``` ### التنازل دون تصريح يمكن تعيين متغير قيمته مع التدمير المنفصل عن تصريحه. - `var name, age; - - ({name, age} = {name: 'neel', age: 22}); -` +``` +var name, age; + +({name, age} = {name: 'neel', age: 22}); +``` > و `( .. )` حول جملة الواجب هو بناء جملة مطلوب عند استخدام التعيين الحرفي كائن الهدف دون تصريح. > @@ -36,22 +38,24 @@ localeTitle: Object Destructuring يمكن فك أي خاصية من أحد الكائنات وتخصيصها لمتغير باسم مختلف عن خاصية الكائن. - `var userInfo = {a: 'neel', b: 22}; - var {a: name, b: bar} = userInfo; - - console.log(name); // neel - console.log(bar); // 22 -` +``` +var userInfo = {a: 'neel', b: 22}; +var {a: name, b: bar} = userInfo; + +console.log(name); // neel +console.log(bar); // 22 +``` ### قيم افتراضية متغير يمكن تعيين الافتراضي، في حالة أن القيمة تفكيك من الكائن هو `undefined` . - `var {name = 'ananonumys', age = 20} = {name: 'neel'}; - - console.log(name); // neel - console.log(age); // 20 -` +``` +var {name = 'ananonumys', age = 20} = {name: 'neel'}; + +console.log(name); // neel +console.log(age); // 20 +``` ### تعيين أسماء المتغيرات الجديدة وتوفير القيم الافتراضية @@ -60,132 +64,139 @@ localeTitle: Object Destructuring 1. تفكيكها من كائن وتعيين لمتغير مع اسم مختلف و 2. تعيين قيمة افتراضية في حالة القيمة غير `undefined` غير `undefined` . - `var {a:name = 'ananonumys', b:age = 20} = {age: 22}; - - console.log(name); // ananonumys - console.log(age); // 22 -` +``` +var {a:name = 'ananonumys', b:age = 20} = {age: 22}; + +console.log(name); // ananonumys +console.log(age); // 22 +``` ### إعداد القيمة الافتراضية لعلامة دالة #### ES5 الإصدار - `function getUserInfo(data) { - data = data === undefined ? {} : data; - var name = data.name === undefined ? 'ananonumys' : data.name; - var age = data.age === undefined ? 20 : data.age; - var location = data.location === undefined ? 'india' : data.location; - console.log(name, age, location); - // print user data - } - - getUserInfo({ - name: 'neel', - age: 22, - location: 'canada' - }); -` +``` +function getUserInfo(data) { + data = data === undefined ? {} : data; + var name = data.name === undefined ? 'ananonumys' : data.name; + var age = data.age === undefined ? 20 : data.age; + var location = data.location === undefined ? 'india' : data.location; + console.log(name, age, location); + // print user data +} + +getUserInfo({ + name: 'neel', + age: 22, + location: 'canada' +}); +``` #### نسخة ES2015 - `function getUserInfo({name = 'ananonumys', age = 20, location = 'india'} = {}) { - console.log(name, age, location); - // print user data - } - - getUserInfo({ - name: 'neel', - age: 22, - location: 'canada' - }); -` +``` +function getUserInfo({name = 'ananonumys', age = 20, location = 'india'} = {}) { + console.log(name, age, location); + // print user data +} + +getUserInfo({ + name: 'neel', + age: 22, + location: 'canada' +}); +``` > في توقيع الدالة `getUserInfo` أعلاه ، يتم تعيين الجانب الأيسر المدمر إلى كائن حرفي فارغ على الجانب الأيمن: `{name = 'ananonumys', age = 20, location = 'india'} = {}` . كان بإمكانك أيضًا كتابة الوظيفة بدون تعيين الجانب الأيمن. ومع ذلك ، إذا قمت `getUserInfo()` تعيين الجانب الأيمن ، ستبحث الدالة عن وسيطة واحدة على الأقل `getUserInfo()` عند استدعاء ، بينما في شكلها الحالي ، يمكنك ببساطة استدعاء `getUserInfo()` دون توفير أي معلمات. يفيد التصميم الحالي إذا كنت تريد أن تكون قادرًا على استدعاء الدالة دون توفير أي معلمات ، يمكن أن يكون الآخر مفيدًا عندما تريد التأكد من تمرير كائن إلى الوظيفة. ### كائن متداخل ومجموعة المدمر - `var metadata = { - title: 'Scratchpad', - translations: [ - { - locale: 'de', - localization_tags: [], - last_edit: '2014-04-14T08:43:37', - url: '/de/docs/Tools/Scratchpad', - title: 'JavaScript-Umgebung' - } - ], - url: '/en-US/docs/Tools/Scratchpad' - }; - - var {title: englishTitle, translations: [{title: localeTitle}]} = metadata; - - console.log(englishTitle); // "Scratchpad" - console.log(localeTitle); // "JavaScript-Umgebung" -` +``` +var metadata = { + title: 'Scratchpad', + translations: [ + { + locale: 'de', + localization_tags: [], + last_edit: '2014-04-14T08:43:37', + url: '/de/docs/Tools/Scratchpad', + title: 'JavaScript-Umgebung' + } + ], + url: '/en-US/docs/Tools/Scratchpad' +}; + +var {title: englishTitle, translations: [{title: localeTitle}]} = metadata; + +console.log(englishTitle); // "Scratchpad" +console.log(localeTitle); // "JavaScript-Umgebung" +``` ### للتكرار والتدمير - `var people = [ - { - name: 'Mike Smith', - family: { - mother: 'Jane Smith', - father: 'Harry Smith', - sister: 'Samantha Smith' - }, - age: 35 - }, - { - name: 'Tom Jones', - family: { - mother: 'Norah Jones', - father: 'Richard Jones', - brother: 'Howard Jones' - }, - age: 25 - } - ]; - - for (var {name: n, family: {father: f}} of people) { - console.log('Name: ' + n + ', Father: ' + f); - } - - // "Name: Mike Smith, Father: Harry Smith" - // "Name: Tom Jones, Father: Richard Jones" -` +``` +var people = [ + { + name: 'Mike Smith', + family: { + mother: 'Jane Smith', + father: 'Harry Smith', + sister: 'Samantha Smith' + }, + age: 35 + }, + { + name: 'Tom Jones', + family: { + mother: 'Norah Jones', + father: 'Richard Jones', + brother: 'Howard Jones' + }, + age: 25 + } +]; + +for (var {name: n, family: {father: f}} of people) { + console.log('Name: ' + n + ', Father: ' + f); +} + +// "Name: Mike Smith, Father: Harry Smith" +// "Name: Tom Jones, Father: Richard Jones" +``` ### تفريغ الحقول من الكائنات التي تم تمريرها كمعلمة دالة - `function userId({id}) { - return id; - } - - function whois({displayName, fullName: {firstName: name}}) { - console.log(displayName + ' is ' + name); - } - - var user = { - id: 42, - displayName: 'jdoe', - fullName: { - firstName: 'John', - lastName: 'Doe' - } - }; - - console.log('userId: ' + userId(user)); // "userId: 42" - whois(user); // "jdoe is John" -` +``` +function userId({id}) { + return id; +} + +function whois({displayName, fullName: {firstName: name}}) { + console.log(displayName + ' is ' + name); +} + +var user = { + id: 42, + displayName: 'jdoe', + fullName: { + firstName: 'John', + lastName: 'Doe' + } +}; + +console.log('userId: ' + userId(user)); // "userId: 42" +whois(user); // "jdoe is John" +``` هذا unpacks `id` و `displayName` و `firstName` من كائن المستخدم `firstName` . ### أسماء خصائص كائن محسوب و destructuring - `let key = 'z'; - let {[key]: foo} = {z: 'bar'}; - - console.log(foo); // "bar" -` +``` +let key = 'z'; +let {[key]: foo} = {z: 'bar'}; + +console.log(foo); // "bar" +``` انظر أيضا: **Object Destructuring** | [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring) \ No newline at end of file diff --git a/guide/arabic/javascript/standard-objects/object/object-freeze/index.md b/guide/arabic/javascript/standard-objects/object/object-freeze/index.md index d33d89d975..ae568430a6 100644 --- a/guide/arabic/javascript/standard-objects/object/object-freeze/index.md +++ b/guide/arabic/javascript/standard-objects/object/object-freeze/index.md @@ -12,8 +12,9 @@ localeTitle: تجميد الكائن ### بناء الجملة - `Object.freeze(obj) -` +```javascript +Object.freeze(obj) +``` ### المعلمات @@ -31,35 +32,36 @@ localeTitle: تجميد الكائن ### مثال - `// Create your object - let person = { - name: 'Johnny', - age: 23, - guild: 'Army of Darkness', - hobbies: ['music', 'gaming', 'rock climbing'] - } - - // Modify your object - person.name = 'John' - person.age = 24 - person.hobbies.splice(1,1) - delete person.guild - - // Verify your object has been modified - console.log(person) // { name: 'John', age: 24, hobbies: ['music', 'rock climbing'] - - // Freeze your object - Object.freeze(person) - - // Verify that your object can no longer be modified - person.name = 'Johnny' // fails silently - person.age = 23 // fails silently - console.log(person) // { name: 'John', age: 24, hobbies: ['music', 'rock climbing'] - - // The freeze is "shallow" and nested objects (including arrays) can still be modified - person.hobbies.push('basketball') - consol.log(person.hobbies) // ['music', 'rock climbing', 'basketball'] -` +```javascript +// Create your object +let person = { + name: 'Johnny', + age: 23, + guild: 'Army of Darkness', + hobbies: ['music', 'gaming', 'rock climbing'] +} + +// Modify your object +person.name = 'John' +person.age = 24 +person.hobbies.splice(1,1) +delete person.guild + +// Verify your object has been modified +console.log(person) // { name: 'John', age: 24, hobbies: ['music', 'rock climbing'] + +// Freeze your object +Object.freeze(person) + +// Verify that your object can no longer be modified +person.name = 'Johnny' // fails silently +person.age = 23 // fails silently +console.log(person) // { name: 'John', age: 24, hobbies: ['music', 'rock climbing'] + +// The freeze is "shallow" and nested objects (including arrays) can still be modified +person.hobbies.push('basketball') +consol.log(person.hobbies) // ['music', 'rock climbing', 'basketball'] +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/object/object-isfrozen/index.md b/guide/arabic/javascript/standard-objects/object/object-isfrozen/index.md index c49ead9587..96a4ad6b63 100644 --- a/guide/arabic/javascript/standard-objects/object/object-isfrozen/index.md +++ b/guide/arabic/javascript/standard-objects/object/object-isfrozen/index.md @@ -8,24 +8,26 @@ localeTitle: الكائن هو المجمدة #### **بناء الجملة** - `Object.isFrozen(obj) -` +```javascript +Object.isFrozen(obj) +``` **فمثلا:** - `var foods = { - grain : "wheat", - dairy : "milk", - vegetable : "carrot", - fruit : "grape" - }; - - var frozenFoods = Object.freeze(foods); - - var areMyFoodsFrozen = Object.isFrozen(frozenFoods); - - \\ returns true -` +```javascript +var foods = { + grain : "wheat", + dairy : "milk", + vegetable : "carrot", + fruit : "grape" +}; + +var frozenFoods = Object.freeze(foods); + +var areMyFoodsFrozen = Object.isFrozen(frozenFoods); + +\\ returns true +``` تذكر ، **لا يمكن أن** يكون له خاصية مجمدة تغير خصائصها. diff --git a/guide/arabic/javascript/standard-objects/object/object-prototype-hasownproperty/index.md b/guide/arabic/javascript/standard-objects/object/object-prototype-hasownproperty/index.md index 212b18c2ac..2ee9ca01ee 100644 --- a/guide/arabic/javascript/standard-objects/object/object-prototype-hasownproperty/index.md +++ b/guide/arabic/javascript/standard-objects/object/object-prototype-hasownproperty/index.md @@ -24,21 +24,22 @@ localeTitle: Object.prototype.hasOwnProperty باستخدام **hasOwnProperty ()** لاختبار ما إذا كانت خاصية موجودة أم لا في كائن محدد: - `var course = { - name: 'freeCodeCamp', - feature: 'is awesome', - } - - var student = { - name: 'enthusiastic student', - } - - course.hasOwnProperty('name'); // returns true - course.hasOwnProperty('feature'); // returns true - - student.hasOwnProperty('name'); // returns true - student.hasOwnProperty('feature'); // returns false -` +```js +var course = { + name: 'freeCodeCamp', + feature: 'is awesome', +} + +var student = { + name: 'enthusiastic student', +} + +course.hasOwnProperty('name'); // returns true +course.hasOwnProperty('feature'); // returns true + +student.hasOwnProperty('name'); // returns true +student.hasOwnProperty('feature'); // returns false +``` #### الروابط diff --git a/guide/arabic/javascript/standard-objects/promise/promise-reject/index.md b/guide/arabic/javascript/standard-objects/promise/promise-reject/index.md index fff361578d..42df2589ac 100644 --- a/guide/arabic/javascript/standard-objects/promise/promise-reject/index.md +++ b/guide/arabic/javascript/standard-objects/promise/promise-reject/index.md @@ -8,13 +8,14 @@ localeTitle: وعد رفض سيسمح لك تسلسل وظيفة catch في نهاية المتصل Promise بالتقاط حالة الخطأ. - `promiseCallingFunction(paramList) - .then( ... ) - ... - .then( ... ) - .catch( function(err) { // catch function - /* - * this is where you can access the reason for the rejection - */ - }); -` \ No newline at end of file +```javascript +promiseCallingFunction(paramList) + .then( ... ) + ... + .then( ... ) + .catch( function(err) { // catch function + /* + * this is where you can access the reason for the rejection + */ + }); +``` \ No newline at end of file diff --git a/guide/arabic/javascript/standard-objects/promise/promise-resolve/index.md b/guide/arabic/javascript/standard-objects/promise/promise-resolve/index.md index 295e982a39..f6d0ec2f3e 100644 --- a/guide/arabic/javascript/standard-objects/promise/promise-resolve/index.md +++ b/guide/arabic/javascript/standard-objects/promise/promise-resolve/index.md @@ -12,32 +12,35 @@ localeTitle: وعد بالقرار يمكن أن تكون "القيمة" لدالة التصميم هي أنواع جافا سكريبت الأساسية ، أو المصفوفات ، أو الكائنات. - `Promise.resolve('success'); // string - Promise.resolve([2, 3, 5]); // array - Promise.resolve({name: 'John', age: '43'}); // object -` +```javascript +Promise.resolve('success'); // string +Promise.resolve([2, 3, 5]); // array +Promise.resolve({name: 'John', age: '43'}); // object +``` A "thenable" هي دالة تأخذ وظيفتي رد اتصال كمعلمات. يمكنك استخدام المعلمة الأولى لتشغيل عملية إكمال ناجحة ، والثاني لإرجاع خطأ في Promise. - `thenableFunction = {then: function(onSuccesss, onFailure) { - if (condition === 'success') { - onSuccess(paramList); // success condition - } else { - onFailure(paramList); // error condition - } - } - } - - Promise.resolve(thenableFunction); -` +```javascript +thenableFunction = {then: function(onSuccesss, onFailure) { + if (condition === 'success') { + onSuccess(paramList); // success condition + } else { + onFailure(paramList); // error condition + } + } +} + +Promise.resolve(thenableFunction); +``` سيؤدي تسلسل وظيفة ثم إلى متصل الوعد إلى الوصول إلى نتيجة `Promise.resolve` . - `promiseCallingFunction(paramList) - .then(function(value) { - /* - * this is where you get access to the value - * returned by a promise on successful completion - */ - }); -` \ No newline at end of file +```javascript +promiseCallingFunction(paramList) + .then(function(value) { + /* + * this is where you get access to the value + * returned by a promise on successful completion + */ + }); +``` \ No newline at end of file diff --git a/guide/arabic/javascript/standard-objects/regexp/regexp-prototype-test/index.md b/guide/arabic/javascript/standard-objects/regexp/regexp-prototype-test/index.md index f554d37ba9..c0abdb27f5 100644 --- a/guide/arabic/javascript/standard-objects/regexp/regexp-prototype-test/index.md +++ b/guide/arabic/javascript/standard-objects/regexp/regexp-prototype-test/index.md @@ -8,27 +8,29 @@ localeTitle: RegExp.prototype.test ## أمثلة - `let str = 'freeCodeCamp'; - let regEx = /Code/; - let result = regEx.test(str); - - console.log(result); // prints true -` +```javascript +let str = 'freeCodeCamp'; +let regEx = /Code/; +let result = regEx.test(str); + +console.log(result); // prints true +``` **ملاحظة:** التعبيرات العادية حساسة لحالة الأحرف. سيظهر المثال أعلاه `false` إذا كان `regEx` `/code/` بدلاً من `/Code/` . لجعل التعبير العادي غير حساس لحالة الأحرف ، يجب عليك إضافة علامة `i` إلى التعبير العادي. - `let str = 'freeCodeCamp'; - let regEx = /code/; - let result = regEx.test(str); - - console.log(result); // prints false - - // Include the 'i' flag. - - regEx = /code/i; - result = regEx.test(str); - console.log(result); // prints true -` +```javascript +let str = 'freeCodeCamp'; +let regEx = /code/; +let result = regEx.test(str); + +console.log(result); // prints false + +// Include the 'i' flag. + +regEx = /code/i; +result = regEx.test(str); +console.log(result); // prints true +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-endswith/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-endswith/index.md index 1bde3c582f..795686a4b9 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-endswith/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-endswith/index.md @@ -8,14 +8,16 @@ localeTitle: String.prototype.endsWith ### فمثلا - `let str = "Hello world"; - let bool = str.endsWith("ld") // true - bool = str.endsWith("llo") // false -` +```js +let str = "Hello world"; +let bool = str.endsWith("ld") // true +bool = str.endsWith("llo") // false +``` يمكن أن تقبل هذه الطريقة أيضًا معلمة أخرى ، وهي `length` الذي يحدد قبل أي حرف للبحث في السلسلة. - `let str = "Hello world"; - let bool = str.endsWith("ld", 5) // false, it's the same as "Hello".endsWith("ld") - bool = str.endsWith("llo", 5) // true, it's the same as "Hello".endsWith("llo") -` \ No newline at end of file +```js +let str = "Hello world"; +let bool = str.endsWith("ld", 5) // false, it's the same as "Hello".endsWith("ld") +bool = str.endsWith("llo", 5) // true, it's the same as "Hello".endsWith("llo") +``` \ No newline at end of file diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-includes/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-includes/index.md index 36eb6ad5ae..e713997de6 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-includes/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-includes/index.md @@ -14,8 +14,9 @@ localeTitle: String.prototype.includes **بناء الجملة** - `string.includes(searchString[, position]) -` +```js +string.includes(searchString[, position]) +``` **المعلمات** @@ -23,30 +24,35 @@ localeTitle: String.prototype.includes **أمثلة** - `let string = "Roses are red, violets are blue."; - - string.includes('red'); // returns true -` +```js +let string = "Roses are red, violets are blue."; - `let string = "Roses are red, violets are blue."; - - string.includes('Red'); // returns false -` +string.includes('red'); // returns true +``` - `let string = "Roses are red, violets are blue."; - - string.includes('red',12); // returns false because 'red' starts at position 9, and our search begins at position 12. -` +```javascript +let string = "Roses are red, violets are blue."; - `let string = "Roses are red, violets are blue."; - - string.includes('blue',12); // returns true because 'blue' starts after our search begins at position 12. -` +string.includes('Red'); // returns false +``` - `let string = "Roses are red, violets are blue."; - - string.includes('violets are blue'); // returns true -` +```javascript +let string = "Roses are red, violets are blue."; + +string.includes('red',12); // returns false because 'red' starts at position 9, and our search begins at position 12. +``` + +```javascript +let string = "Roses are red, violets are blue."; + +string.includes('blue',12); // returns true because 'blue' starts after our search begins at position 12. +``` + +```javascript +let string = "Roses are red, violets are blue."; + +string.includes('violets are blue'); // returns true +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-indexof/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-indexof/index.md index c39f6ce73a..992b5b5476 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-indexof/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-indexof/index.md @@ -8,8 +8,9 @@ localeTitle: String.prototype.indexOf **بناء الجملة** - `str.indexOf(searchValue[, fromIndex]) -` +```javascript +str.indexOf(searchValue[, fromIndex]) +``` ### المعلمات @@ -24,17 +25,18 @@ localeTitle: String.prototype.indexOf ### أمثلة - `'Blue Whale'.indexOf('Blue'); // returns 0 - 'Blue Whale'.indexOf('Blute'); // returns -1 - 'Blue Whale'.indexOf('Whale', 0); // returns 5 - 'Blue Whale'.indexOf('Whale', 5); // returns 5 - 'Blue Whale'.indexOf('Whale', 7); // returns -1 - 'Blue Whale'.indexOf(''); // returns 0 - 'Blue Whale'.indexOf('', 9); // returns 9 - 'Blue Whale'.indexOf('', 10); // returns 10 - 'Blue Whale'.indexOf('', 11); // returns 10 - 'Blue Whale'.indexOf('blue'); // returns -1 -` +```javascript +'Blue Whale'.indexOf('Blue'); // returns 0 +'Blue Whale'.indexOf('Blute'); // returns -1 +'Blue Whale'.indexOf('Whale', 0); // returns 5 +'Blue Whale'.indexOf('Whale', 5); // returns 5 +'Blue Whale'.indexOf('Whale', 7); // returns -1 +'Blue Whale'.indexOf(''); // returns 0 +'Blue Whale'.indexOf('', 9); // returns 9 +'Blue Whale'.indexOf('', 10); // returns 10 +'Blue Whale'.indexOf('', 11); // returns 10 +'Blue Whale'.indexOf('blue'); // returns -1 +``` ### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-split/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-split/index.md index 5d9a8a774e..c7b513621b 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-split/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-split/index.md @@ -12,26 +12,28 @@ localeTitle: String.prototype.split أمثلة: - `// We have a regular string - "Hello. I am a string. You can separate me." - - // Let's use the split function to separate the string by the period character: - "Hello. I am a string. You can separate me.".split("."); - // output is [ "Hello", " I am a string", " You can separate me", "" ] -` +```js +// We have a regular string +"Hello. I am a string. You can separate me." + +// Let's use the split function to separate the string by the period character: +"Hello. I am a string. You can separate me.".split("."); +// output is [ "Hello", " I am a string", " You can separate me", "" ] +``` بما أننا استخدمنا النقطة ( `.` ) _كسلسلة فاصلة_ ، فإن السلاسل في صفيف الخرج لا تحتوي على الفترة الموجودة فيها ؛ _لا تتضمن_ سلاسل فصل الإخراج _سلسلة سلسلة فاصل الإدخال نفسه_ . ليس من الضروري أن يكون _فاصل السلسلة_ حرفًا واحدًا ، يمكن أن يكون أي سلسلة أخرى: - `"Hello... I am another string... keep on learning!".split("..."); - // output is [ "Hello", " I am another string", " keep on learning!" ] - - const names = "Kratos- Atreus- Freya- Hela- Thor- Odin"; - // notice separator is a dash and a space - names.split("- "); - // output is [ "Kratos", "Atreus", "Freya", "Hela", "Thor", "Odin" ] -` +```js +"Hello... I am another string... keep on learning!".split("..."); +// output is [ "Hello", " I am another string", " keep on learning!" ] + +const names = "Kratos- Atreus- Freya- Hela- Thor- Odin"; +// notice separator is a dash and a space +names.split("- "); +// output is [ "Kratos", "Atreus", "Freya", "Hela", "Thor", "Odin" ] +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-substr/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-substr/index.md index 6821608d2b..a68bb37650 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-substr/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-substr/index.md @@ -17,14 +17,16 @@ localeTitle: String.prototype.substr #### أمثلة: - `let str = "Hello world!"; - let res = str.substr(1, 4); -` +```JavaScript +let str = "Hello world!"; +let res = str.substr(1, 4); +``` ستكون نتيجة الدقة: - `ello -` +``` +ello +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-substring/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-substring/index.md index 30c9c79132..b4118657ea 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-substring/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-substring/index.md @@ -10,18 +10,20 @@ localeTitle: String.prototype.substring أمثلة: - `"Hello, campers".substring(7, 14); - // output is "campers" - - "Hello, world".substring(0, 5); - // output is "Hello" -` +```js +"Hello, campers".substring(7, 14); +// output is "campers" + +"Hello, world".substring(0, 5); +// output is "Hello" +``` يمكنك أيضًا حذف معلمة فهرس الأحرف الأخيرة ، وسيتم استخراج التسلسل الفرعي من فهرس البدء حتى نهاية السلسلة. مثال: - `"Hello, campers!".substring(7); - // output is "campers!" -` +```js +"Hello, campers!".substring(7); +// output is "campers!" +``` #### معلومات اكثر: diff --git a/guide/arabic/javascript/standard-objects/string/string-prototype-trim/index.md b/guide/arabic/javascript/standard-objects/string/string-prototype-trim/index.md index 5daf78e4f6..f45a3c4239 100644 --- a/guide/arabic/javascript/standard-objects/string/string-prototype-trim/index.md +++ b/guide/arabic/javascript/standard-objects/string/string-prototype-trim/index.md @@ -8,9 +8,10 @@ localeTitle: String.prototype.trim أمثلة: - `" Hello, campers. I have spaces on both ends! ".trim(); - // output is "Hello, campers. I have spaces on both ends!" -` +```js +" Hello, campers. I have spaces on both ends! ".trim(); +// output is "Hello, campers. I have spaces on both ends!" +``` `trim()` لا يزيل فقط أحرف الفضاء. يزيل أي حرف مسافة بيضاء ، مثل علامات التبويب ، فواصل الأسطر ، فواصل عدم الانكسار ، إلخ. diff --git a/guide/arabic/javascript/strict-mode/index.md b/guide/arabic/javascript/strict-mode/index.md index ad2e036e11..a89a96a4f2 100644 --- a/guide/arabic/javascript/strict-mode/index.md +++ b/guide/arabic/javascript/strict-mode/index.md @@ -12,16 +12,17 @@ localeTitle: الوضع الصارم يمكن أن تتعايش شفرة الأسلوب الصارم ورمز الوضع غير المقيد في نفس البرنامج النصي. - `// Non-strict code... - - (function(){ - "use strict"; - - // Define your library strictly... - })(); - - // Non-strict code... -` +```javascript +// Non-strict code... + +(function(){ + "use strict"; + + // Define your library strictly... +})(); + +// Non-strict code... +``` ## استدعاء وضع صارم @@ -29,24 +30,26 @@ localeTitle: الوضع الصارم **وضع صارم للنصوص** - `// Whole-script strict mode syntax - - "use strict"; - var v = "Hi! I'm a strict mode script!"; -` +```javascript +// Whole-script strict mode syntax + +"use strict"; +var v = "Hi! I'm a strict mode script!"; +``` **وضع صارم للوظائف** - `function strict(){ - // Function-level strict mode syntax - - 'use strict'; - function nested() { return "And so am I!"; } - return "Hi! I'm a strict mode function! " + nested(); - } - - function notStrict() { return "I'm not strict."; } -` +```javascript +function strict(){ + // Function-level strict mode syntax + + 'use strict'; + function nested() { return "And so am I!"; } + return "Hi! I'm a strict mode function! " + nested(); +} + +function notStrict() { return "I'm not strict."; } +``` **في الأساس ، يساعدك على ارتكاب أخطاء أقل ، من خلال اكتشاف الأشياء التي قد تؤدي إلى حدوث كسر والتي لا يتم اكتشافها بشكل طبيعي (الوضع غير الصارم).** diff --git a/guide/arabic/javascript/switch-statements/index.md b/guide/arabic/javascript/switch-statements/index.md index 7c1b3f2330..394906f603 100644 --- a/guide/arabic/javascript/switch-statements/index.md +++ b/guide/arabic/javascript/switch-statements/index.md @@ -8,17 +8,18 @@ localeTitle: تبديل العبارات ### بناء الجملة: - `switch(expression) { - case 1: - console.log('1'); - break; - case 2: - console.log('2'); - break; - default: - console.log('No true condition, default'); - } -` +```javascript +switch(expression) { + case 1: + console.log('1'); + break; + case 2: + console.log('2'); + break; + default: + console.log('No true condition, default'); +} +``` يظهر المقتطف أعلاه بناء الجملة لبيان `switch` أساسي. في هذا المثال ، هناك 3 سيناريوهات مختلفة لـ: @@ -32,19 +33,20 @@ localeTitle: تبديل العبارات فمثلا: - `var someValue; - var expression = someValue; - switch(expression){ - case someValue: - console.log('10'); // 10 would be printed to the console - break; - case 23: - console.log('12'); - break; - default: - console.log('No matches'); - } -` +```javascript +var someValue; +var expression = someValue; +switch(expression){ + case someValue: + console.log('10'); // 10 would be printed to the console + break; + case 23: + console.log('12'); + break; + default: + console.log('No matches'); +} +``` ملاحظة: يمكن أن يكون `expression` في المقتطف أعلاه عبارة عن سلسلة أو رقم. @@ -52,17 +54,18 @@ localeTitle: تبديل العبارات مطلوب الكلمة الأساسية `break` في كل حالة للتأكد من أن يتم تنفيذ التعليمات البرمجية فقط في هذه الحالة. بدون الفاصل ، يمكن تنفيذ عدة حالات. عندما تصل JavaScript إلى كلمة رئيسية `break` ، فإنها `break` عن كتلة المحول. إذا تم ترك `break` خارج المثال أعلاه ، فهذا ما سيحدث: - `var expression = 1; - switch(expression) { - case 1: - console.log('1'); // 1 would be printed to console - case 2: // As there is no break after case 1, this case is also executed. - console.log('2'); // 2 would be printed to the console. - break; // break -> Switch statement is exited - default: - console.log('No true condition, default'); - } -` +```javascript +var expression = 1; +switch(expression) { + case 1: + console.log('1'); // 1 would be printed to console + case 2: // As there is no break after case 1, this case is also executed. + console.log('2'); // 2 would be printed to the console. + break; // break -> Switch statement is exited + default: + console.log('No true condition, default'); +} +``` ### تنفيذ حالات متعددة: @@ -70,19 +73,20 @@ localeTitle: تبديل العبارات على سبيل المثال: - `switch (day) { - case 4: - case 5: - console.log('it is nearly the weekend'); - break; - case 0: - case 6: - console.log('it is the weekend'); - break; - default: - console.log('Looking forward to the Weekend'); - } -` +```javascript +switch (day) { + case 4: + case 5: + console.log('it is nearly the weekend'); + break; + case 0: + case 6: + console.log('it is the weekend'); + break; + default: + console.log('Looking forward to the Weekend'); +} +``` في المقتطف أعلاه: diff --git a/guide/arabic/javascript/ternary-operator/index.md b/guide/arabic/javascript/ternary-operator/index.md index 69045b3ab0..0dc6b10403 100644 --- a/guide/arabic/javascript/ternary-operator/index.md +++ b/guide/arabic/javascript/ternary-operator/index.md @@ -4,8 +4,9 @@ localeTitle: مشغل ثلاثي --- يستبدل مشغل Ternary كتلة `if` / `else` بتنسيق مكثف. ما يلي هو الشكل العام للمشغل الثلاثي. - `condition ? expr1 : expr2 -` +``` +condition ? expr1 : expr2 +``` ## وصف @@ -13,10 +14,11 @@ localeTitle: مشغل ثلاثي على سبيل المثال ، لعرض رسالة مختلفة بناءً على قيمة متغير isMember ، يمكنك استخدام هذا البيان: - `let isMember = true; - - let message = isMember ? 'Welcome Back!' : 'You need to login'; // 'Welcome Back' -` +```javascript +let isMember = true; + +let message = isMember ? 'Welcome Back!' : 'You need to login'; // 'Welcome Back' +``` ومن الطرق المفيدة الأخرى لاستخدام المشغل الثلاثي هو حثه على تنفيذ وظيفة أو طريقة بشكل مشروط diff --git a/guide/arabic/javascript/this-reference/index.md b/guide/arabic/javascript/this-reference/index.md index 3ab34b9440..67d03b450d 100644 --- a/guide/arabic/javascript/this-reference/index.md +++ b/guide/arabic/javascript/this-reference/index.md @@ -10,13 +10,14 @@ localeTitle: هذا المرجع عندما يتم استدعاء دالة في النطاق العمومي ، يكون `this` المرجع بشكل افتراضي مرتبطًا **بالعنصر العام** ( `window` في المستعرض ، أو `global` في Node.js). فمثلا: - `function foo() { - this.a = 2; - } - - foo(); - console.log(a); // 2 -` +```javascript +function foo() { + this.a = 2; +} + +foo(); +console.log(a); // 2 +``` ملاحظة: إذا قمت بالإعلان عن الدالة `foo()` أعلاه في الوضع المقيد ، فإنك تقوم باستدعاء هذه الوظيفة في النطاق العالمي ، فسيكون `this` `undefined` `this.a = 2` التعيين هذا. `this.a = 2` إلى `this.a = 2` استثناء `Uncaught TypeError` . @@ -24,17 +25,18 @@ localeTitle: هذا المرجع دعونا نفحص المثال أدناه: - `function foo() { - this.a = 2; - } - - var obj = { - foo: foo - }; - - obj.foo(); - console.log(obj.a); // 2 -` +```javascript +function foo() { + this.a = 2; +} + +var obj = { + foo: foo +}; + +obj.foo(); +console.log(obj.a); // 2 +``` بوضوح ، في المقتطف أعلاه ، يتم استدعاء الدالة `foo()` مع _السياق_ هو كائن `obj` `this` الإشارة مرتبطة الآن بـ `obj` . لذلك عندما يتم استدعاء دالة مع كائن سياق ، سيكون `this` المرجع مرتبطًا بهذا الكائن. @@ -42,12 +44,13 @@ localeTitle: هذا المرجع `.call` ، `.apply` و `.bind` يمكن لجميع استخدامها في موقع الدعوة إلى ربط صراحة `this` . باستخدام `.bind(this)` هو شيء قد تراه في الكثير من مكونات React. - `var foo = function() { - console.log(this.bar) - } - - foo.call({ bar: 1 }) // 1 -` +```javascript +var foo = function() { + console.log(this.bar) +} + +foo.call({ bar: 1 }) // 1 +``` في ما يلي مثال سريع عن كيفية استخدام كل منها لربط `this` : @@ -57,15 +60,16 @@ localeTitle: هذا المرجع ### القاعدة 4 - `function Point2D(x, y) { - this.x = x; - this.y = y; - } - - var p1 = new Point2D(1, 2); - console.log(p1.x); // 1 - console.log(p1.y); // 2 -` +```javascript +function Point2D(x, y) { + this.x = x; + this.y = y; +} + +var p1 = new Point2D(1, 2); +console.log(p1.x); // 1 +console.log(p1.y); // 2 +``` الشيء الذي يجب أن تلاحظه هو الدالة `Point2D` التي يتم `Point2D` رئيسية `new` ، `this` المرجع مرتبط بـ كائن `p1` . لذلك عندما يتم استدعاء دالة بكلمة رئيسية `new` ، فإنها ستنشئ كائنًا جديدًا وستكون `this` الإشارة مرتبطة بهذا الكائن. @@ -77,16 +81,17 @@ localeTitle: هذا المرجع خذ بعين الاعتبار هذا المثال لفئة Cat باستخدام طريقة تسمى `makeSound()` ، متبعاً النمط في القاعدة 4 (أعلاه) مع دالة منشئ وكلمة رئيسية `new` . - `var Cat = function(name, sound) { - this.name = name; - this.sound = sound; - this.makeSound = function() { - console.log( this.name + ' says: ' + this.sound ); - }; - } - var kitty = new Cat('Fat Daddy', 'Mrrooowww'); - kitty.makeSound(); // Fat Daddy says: Mrrooowww -` +```javascript +var Cat = function(name, sound) { + this.name = name; + this.sound = sound; + this.makeSound = function() { + console.log( this.name + ' says: ' + this.sound ); + }; +} +var kitty = new Cat('Fat Daddy', 'Mrrooowww'); +kitty.makeSound(); // Fat Daddy says: Mrrooowww +``` الآن دعونا نحاول إعطاء القطة وسيلة `annoy()` الناس عن طريق تكرار صوته 100 مرة ، مرة واحدة كل نصف ثانية. @@ -117,50 +122,52 @@ localeTitle: هذا المرجع 1) قبل إنشاء إطار جديد، تعيين `this` إلى متغير محلي يدعى `me` ، أو `self` ، أو ما تريد أن نسميها، واستخدام هذا المتغير داخل الاستدعاء. - `var Cat = function(name, sound) { - this.name = name; - this.sound = sound; - this.makeSound = function() { - console.log( this.name + ' says: ' + this.sound ); - }; - this.annoy = function() { - var count = 0, max = 100; - var self = this; - var t = setInterval(function() { - self.makeSound(); - count++; - if (count === max) { - clearTimeout(t); - } - }, 500); - }; - } - var kitty = new Cat('Fat Daddy', 'Mrrooowww'); - kitty.annoy(); -` +```javascript +var Cat = function(name, sound) { + this.name = name; + this.sound = sound; + this.makeSound = function() { + console.log( this.name + ' says: ' + this.sound ); + }; + this.annoy = function() { + var count = 0, max = 100; + var self = this; + var t = setInterval(function() { + self.makeSound(); + count++; + if (count === max) { + clearTimeout(t); + } + }, 500); + }; +} +var kitty = new Cat('Fat Daddy', 'Mrrooowww'); +kitty.annoy(); +``` 2) باستخدام ES6 ، يمكنك تجنب تعيين `this` للمتغير المحلي باستخدام وظيفة السهم ، والتي تربط `this` بسياق الرمز المحيط حيث تم تعريفه. - `var Cat = function(name, sound) { - this.name = name; - this.sound = sound; - this.makeSound = function() { - console.log( this.name + ' says: ' + this.sound ); - }; - this.annoy = function() { - var count = 0, max = 100; - var t = setInterval(() => { - this.makeSound(); - count++; - if (count === max) { - clearTimeout(t); - } - }, 500); - }; - } - var kitty = new Cat('Fat Daddy', 'Mrrooowww'); - kitty.annoy(); -` +```javascript +var Cat = function(name, sound) { + this.name = name; + this.sound = sound; + this.makeSound = function() { + console.log( this.name + ' says: ' + this.sound ); + }; + this.annoy = function() { + var count = 0, max = 100; + var t = setInterval(() => { + this.makeSound(); + count++; + if (count === max) { + clearTimeout(t); + } + }, 500); + }; +} +var kitty = new Cat('Fat Daddy', 'Mrrooowww'); +kitty.annoy(); +``` ### موارد آخرى diff --git a/guide/arabic/javascript/timing-events/index.md b/guide/arabic/javascript/timing-events/index.md index 2e90fda7d0..3b7be44f29 100644 --- a/guide/arabic/javascript/timing-events/index.md +++ b/guide/arabic/javascript/timing-events/index.md @@ -12,16 +12,17 @@ localeTitle: أحداث التوقيت مثال `setTimeout()` : - `var timeoutID; - - function delayTimer() { - timeoutID = setTimeout(delayedFunction, 3000); - } - - function delayedFunction() { - alert(“Three seconds have elapsed.”); - } -` +```javascript +var timeoutID; + +function delayTimer() { + timeoutID = setTimeout(delayedFunction, 3000); +} + +function delayedFunction() { + alert(“Three seconds have elapsed.”); +} +``` عندما يتم استدعاء الدالة delayTimer فإنه سيتم تشغيل setTimeout. بعد مرور 3 ثوانٍ ، سيتم تنفيذ الأمر delayedFunction الذي سيرسل تنبيهًا. @@ -29,16 +30,17 @@ localeTitle: أحداث التوقيت مثال `setInterval()` : - `var intervalID; - - function repeatEverySecond() { - intervalID = setInterval(sendMessage, 1000); - } - - function sendMessage() { - console.log(“One second elapsed.”); - } -` +```javascript +var intervalID; + +function repeatEverySecond() { + intervalID = setInterval(sendMessage, 1000); +} + +function sendMessage() { + console.log(“One second elapsed.”); +} +``` عند استدعاء التعليمات البرمجية الخاصة بك الدالة repeatEverySecond سيتم تشغيله setInterval. سوف setInterval تشغيل وظيفة sendMessage كل 1000 ميلي ثانية. @@ -52,17 +54,18 @@ localeTitle: أحداث التوقيت مثال: - `var timeoutID; - - function delayTimer() { - timeoutID = setTimeout(delayedFunction, 3000); - } - - function delayedFunction() { - alert(“Three seconds have elapsed.”); - } - - function clearAlert() { - clearTimeout(timeoutID); - } -` \ No newline at end of file +```javascript +var timeoutID; + +function delayTimer() { + timeoutID = setTimeout(delayedFunction, 3000); +} + +function delayedFunction() { + alert(“Three seconds have elapsed.”); +} + +function clearAlert() { + clearTimeout(timeoutID); +} +``` \ No newline at end of file diff --git a/guide/arabic/javascript/tutorials/add-new-properties-to-a-javascript-object/index.md b/guide/arabic/javascript/tutorials/add-new-properties-to-a-javascript-object/index.md index e669538213..f61d4ea6ae 100644 --- a/guide/arabic/javascript/tutorials/add-new-properties-to-a-javascript-object/index.md +++ b/guide/arabic/javascript/tutorials/add-new-properties-to-a-javascript-object/index.md @@ -13,11 +13,13 @@ localeTitle: أضف خصائص جديدة إلى كائن JavaScript إليك كيفية استخدام تدرج قوس: - `myObject['bark'] = "woof-woof"; -` +```javascript +myObject['bark'] = "woof-woof"; +``` باستخدام تدرج القوس ، يمكننا استخدام المتغيرات كأسماء للممتلكات: - `var dynamicProperty = "bark"; - myObject[dynamicProperty] = "woof-woof"; -` \ No newline at end of file +```javascript +var dynamicProperty = "bark"; +myObject[dynamicProperty] = "woof-woof"; +``` \ No newline at end of file diff --git a/guide/arabic/javascript/tutorials/comment-your-javascript-code/index.md b/guide/arabic/javascript/tutorials/comment-your-javascript-code/index.md index 74a5f43741..2cd8b985ad 100644 --- a/guide/arabic/javascript/tutorials/comment-your-javascript-code/index.md +++ b/guide/arabic/javascript/tutorials/comment-your-javascript-code/index.md @@ -12,9 +12,10 @@ localeTitle: تعليق كود جافاسكريبت الخاص بك * سيعلق تعليق slash-star-star-slash كل شيء بين `/*` و `*/` characters: - `/* - This is - a multi-line comment - (comment block) - */ -` \ No newline at end of file +```javascript +/* +This is +a multi-line comment +(comment block) +*/ +``` \ No newline at end of file diff --git a/guide/arabic/javascript/tutorials/debugging-node-files-using-cli-commands/index.md b/guide/arabic/javascript/tutorials/debugging-node-files-using-cli-commands/index.md index e691a2bfb0..c6abac1a40 100644 --- a/guide/arabic/javascript/tutorials/debugging-node-files-using-cli-commands/index.md +++ b/guide/arabic/javascript/tutorials/debugging-node-files-using-cli-commands/index.md @@ -8,13 +8,15 @@ localeTitle: تصحيح ملفات عقدة باستخدام أوامر CLI لنفترض أن لديك ملفًا باسم `contents.js` . يمكنك تشغيل الملف باستخدام أمر `node` . - `node contents.js -` +```bash +node contents.js +``` يجب أن يكون هذا معروفًا لك منذ كتابة رمز Node.js. والآن يجب تصحيح أي أخطاء تنبثق. لتشغيل الملف في وضع التصحيح إلحاق الكلمة `inspect` أثناء تشغيل الملف. - `node inspect contents.js -` +```bash +node inspect contents.js +``` الآن سيفتح هذا الأمر ملفك في وضع التصحيح. من الآن فصاعدًا ، يمكنك التنقل خلال سطر واحد من الكود في كل مرة بالضغط على المفتاح **N** في لوحة المفاتيح. diff --git a/guide/arabic/javascript/tutorials/declare-javascript-objects-as-variables/index.md b/guide/arabic/javascript/tutorials/declare-javascript-objects-as-variables/index.md index 20b29bfc73..7ce4fa9d8a 100644 --- a/guide/arabic/javascript/tutorials/declare-javascript-objects-as-variables/index.md +++ b/guide/arabic/javascript/tutorials/declare-javascript-objects-as-variables/index.md @@ -15,16 +15,19 @@ localeTitle: قم بتعريف كائنات JavaScript كمتغيرات باستخدام ميزة التدوين النقطي: - `console.log(car.wheels); // 4 -` +```javascript +console.log(car.wheels); // 4 +``` باستخدام تدرج قوس: - `console.log(car["wheels"]); // 1 -` +```javascript +console.log(car["wheels"]); // 1 +``` استخدام تدرج قوس ديناميكي: - `var seatsProperty = "seats"; - console.log(car[seatsProperty]); // 5 -` \ No newline at end of file +```javascript +var seatsProperty = "seats"; +console.log(car[seatsProperty]); // 5 +``` \ No newline at end of file diff --git a/guide/arabic/javascript/tutorials/delete-properties-from-a-javascript-object/index.md b/guide/arabic/javascript/tutorials/delete-properties-from-a-javascript-object/index.md index ccb250f321..60ccbba62a 100644 --- a/guide/arabic/javascript/tutorials/delete-properties-from-a-javascript-object/index.md +++ b/guide/arabic/javascript/tutorials/delete-properties-from-a-javascript-object/index.md @@ -27,11 +27,12 @@ localeTitle: حذف الخصائص من كائن JavaScript ## مثال - `var person = {name:'Jay', age:'52'}; - delete person['age']; - - console.log(person); //{name:'Jay'} -` +```js +var person = {name:'Jay', age:'52'}; +delete person['age']; + +console.log(person); //{name:'Jay'} +``` ## قيمة الإرجاع diff --git a/guide/arabic/javascript/tutorials/detect-authentic-click-events/index.md b/guide/arabic/javascript/tutorials/detect-authentic-click-events/index.md index 17dda228c7..31706361f8 100644 --- a/guide/arabic/javascript/tutorials/detect-authentic-click-events/index.md +++ b/guide/arabic/javascript/tutorials/detect-authentic-click-events/index.md @@ -10,16 +10,17 @@ localeTitle: اكتشاف أحداث النقرات الأصلية #### هنا مثال على استخدام هذه الطريقة - `// Assume there is a button in the HTML - const button = document.querySelector('button'); - - button.addEventListener('click', (e) => { - if (e.isTrusted) { - console.log('Button clicked by a real user'); - } else { - console.log('Button click simulated by a script'); - } - }); - - button.click() // Outputs "Button click simulated by a script" -` \ No newline at end of file +```javascript +// Assume there is a button in the HTML +const button = document.querySelector('button'); + +button.addEventListener('click', (e) => { + if (e.isTrusted) { + console.log('Button clicked by a real user'); + } else { + console.log('Button click simulated by a script'); + } +}); + +button.click() // Outputs "Button click simulated by a script" +``` \ No newline at end of file diff --git a/guide/arabic/javascript/tutorials/how-to-create-a-slideshow/index.md b/guide/arabic/javascript/tutorials/how-to-create-a-slideshow/index.md index 9bdbcaf768..9e48a971e7 100644 --- a/guide/arabic/javascript/tutorials/how-to-create-a-slideshow/index.md +++ b/guide/arabic/javascript/tutorials/how-to-create-a-slideshow/index.md @@ -12,10 +12,11 @@ localeTitle: كيف تصنع عرض الشرائح \`\` \`أتش تي أم أل عرض الشرائح - `### Write styles to hide slides and show only one slide. - - For hide the slides you have to give them a default style and only show one slide if this is active or you want to show it. -` +``` +### Write styles to hide slides and show only one slide. + +For hide the slides you have to give them a default style and only show one slide if this is active or you want to show it. +``` المغلق \[data-component = "slideshow"\] .slide { عرض لا شيء؛ } diff --git a/guide/arabic/javascript/tutorials/how-to-create-popups/index.md b/guide/arabic/javascript/tutorials/how-to-create-popups/index.md index ce9d6793cc..c59e4fd721 100644 --- a/guide/arabic/javascript/tutorials/how-to-create-popups/index.md +++ b/guide/arabic/javascript/tutorials/how-to-create-popups/index.md @@ -22,9 +22,10 @@ localeTitle: كيفية إنشاء النوافذ المنبثقة X - `### Step 2 CSS - We will choose our own style for the popup window. Notice: the popup div should be hidden at first, so in the style I will select display: none; -` +``` +### Step 2 CSS +We will choose our own style for the popup window. Notice: the popup div should be hidden at first, so in the style I will select display: none; +``` المغلق .popup _main_ div { الموقع: ثابت العرض: 800 بكسل ؛ الارتفاع: 400 بكسل ؛ border: 2px solid black؛ border-radius: 5px؛ لون الخلفية: #fff؛ اليسار: 50 ٪. الهامش الأيسر: -400 بكسل ؛ أعلى: 50 ٪ ؛ الهامش العلوي: - 250 بكسل ؛ عرض لا شيء؛ @@ -34,8 +35,9 @@ X } - `### Step 3 JavaScript -` +``` +### Step 3 JavaScript +``` شبيبة // بادئ ذي بدء ، سوف أقوم بتهيئة متغيراتي // اختر العناصر التي سنستخدمها من DOM // أقوم بإضافة حدث en في الزر الذي سيؤدي إلى تشغيل وظيفة من شأنها تغيير نمط العرض المنبثق من لا شيء إلى حظر diff --git a/guide/arabic/javascript/tutorials/page-redirects-using-javascript/index.md b/guide/arabic/javascript/tutorials/page-redirects-using-javascript/index.md index dd16d7b455..102cb656ce 100644 --- a/guide/arabic/javascript/tutorials/page-redirects-using-javascript/index.md +++ b/guide/arabic/javascript/tutorials/page-redirects-using-javascript/index.md @@ -10,10 +10,11 @@ localeTitle: صفحة يعيد التوجيه باستخدام جافا سكري هناك عدة طرق مختلفة للقيام بذلك ، ولكن أبسط طريقة هي استخدام الكائن `window.location` لإرسال المستخدم إلى الصفحة التي ترغب في إعادة توجيههم إليها. يمكن أن يستخدم كائن `window.location` أي قيمة URL صالحة مثل `http://www.yoururl.com` ، `somepage.html` ، إلخ. - `window.location = 'http://www.yoururl.com'; - // window.location = 'somepage.html'; - // etc. -` +```javascript +window.location = 'http://www.yoururl.com'; +// window.location = 'somepage.html'; +// etc. +``` ### حالة خاصة إعادة توجيه @@ -21,23 +22,25 @@ localeTitle: صفحة يعيد التوجيه باستخدام جافا سكري فيما يلي مثال على استخدام هذه الطريقة (ستظل تعمل بنفس طريقة استخدام `window.location` في المتصفحات الأخرى): - `window.location.replace('http://www.yoururl.com'); - // window.location.replace('somepage.html'); - // etc. -` +```javascript +window.location.replace('http://www.yoururl.com'); +// window.location.replace('somepage.html'); +// etc. +``` ### A إعادة توجيه توقيت بسيط باستخدام JS هنا مثال على إعادة توجيه بسيطة موقوتة باستخدام وظيفة `setTimeout()` . تُعد عمليات إعادة التوجيه المحددة التوقيت مفيدة حتى يمكنك شرحها للمستخدم ، عبر المحتوى الموجود على صفحة إعادة التوجيه ، والسبب في إعادة توجيهها إلى صفحة أخرى. - `// the 5000 below is 5000 milliseconds which equals 5 seconds until the redirect happens - // keep in mind that 1 second = 1000 milliseconds - setTimeout(function () { - window.location = 'http://www.yoururl.com'; - // window.location = 'somepage.html'; - // etc. - }, 5000); -` +```javascript +// the 5000 below is 5000 milliseconds which equals 5 seconds until the redirect happens +// keep in mind that 1 second = 1000 milliseconds +setTimeout(function () { + window.location = 'http://www.yoururl.com'; + // window.location = 'somepage.html'; + // etc. +}, 5000); +``` ### تراجع @@ -45,11 +48,11 @@ localeTitle: صفحة يعيد التوجيه باستخدام جافا سكري ضع عنصر `` داخل `
` للمستند الخاص بك مثل: - ` - - - - -` +```html + + + + +``` ضع في اعتبارك أنه ليس كل المتصفحات تدعم العنصر `` (أنا أبحث عنك ، والإصدارات الأقدم من IE ، و Safari) ، ولكن معظم المتصفحات الحديثة تفعل (Microsoft Edge ، Google Chrome ، Mozilla Firefox ، Opera). \ No newline at end of file diff --git a/guide/arabic/javascript/tutorials/what-does-javascript-void-0-mean/index.md b/guide/arabic/javascript/tutorials/what-does-javascript-void-0-mean/index.md index f087384151..2d82f4e8eb 100644 --- a/guide/arabic/javascript/tutorials/what-does-javascript-void-0-mean/index.md +++ b/guide/arabic/javascript/tutorials/what-does-javascript-void-0-mean/index.md @@ -20,13 +20,13 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean #### مثال 1 نموذج مع void Javascript (0): - ` - - - Click Me - - -` +```html + + +Click Me + + +``` #### انتاج : @@ -36,13 +36,13 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean #### مثال 2 نموذج مع void Javascript (0): - ` - - - Click Me - - -` +```html + + +Click Me + + +``` #### انتاج : @@ -50,14 +50,14 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean #### مثال 3 نموذج مع void Javascript (0): - ` - - - Click Me - - -` +```html + + +Click Me + + +``` #### انتاج : @@ -65,13 +65,13 @@ localeTitle: ماذا يفعل جافا سكريبت Void 0 Mean #### مثال نموذج دون void Javascript (0): - ` - - - Click Me - - -` +```html + + +Click Me + + +``` #### انتاج : diff --git a/guide/arabic/javascript/typeof/index.md b/guide/arabic/javascript/typeof/index.md index 9181db9dc3..6691e37999 100644 --- a/guide/arabic/javascript/typeof/index.md +++ b/guide/arabic/javascript/typeof/index.md @@ -10,77 +10,85 @@ localeTitle: نوع من فمثلا: - `var x = 12345; // number - x = 'string'; // string - x = { key: 'value' }; // object -` +```javascript +var x = 12345; // number +x = 'string'; // string +x = { key: 'value' }; // object +``` كما ترى من المثال أعلاه ، يمكن للمتغير في JavaScript تغيير الأنواع خلال تنفيذ البرنامج. يمكن أن يكون من الصعب تعقب كمبرمج ، وهذا هو المكان الذي يكون فيه عامل التشغيل `typeof` مفيدًا. عامل التشغيل `typeof` بإرجاع سلسلة تمثل النوع الحالي للمتغير. يمكنك استخدامه عن طريق كتابة `typeof(variable)` أو `typeof variable` . بالعودة إلى المثال السابق ، يمكنك استخدامه للتحقق من نوع المتغير `x` في كل مرحلة: - `var x = 12345; - console.log(typeof x) // number - x = 'string'; - console.log(typeof x) // string - x = { key: 'value' }; - console.log(typeof x) // object -` +```javascript +var x = 12345; +console.log(typeof x) // number +x = 'string'; +console.log(typeof x) // string +x = { key: 'value' }; +console.log(typeof x) // object +``` هذا يمكن أن يكون مفيدا للتحقق من نوع متغير في وظيفة والاستمرار حسب الاقتضاء. في ما يلي مثال لدالة يمكن أن تأخذ متغيرًا هو سلسلة أو رقم: - `function doSomething(x) { - if(typeof(x) === 'string') { - alert('x is a string') - } else if(typeof(x) === 'number') { - alert('x is a number') - } - } -` +```javascript +function doSomething(x) { + if(typeof(x) === 'string') { + alert('x is a string') + } else if(typeof(x) === 'number') { + alert('x is a number') + } +} +``` طريقة أخرى لمشغل `typeof` يمكن أن تكون مفيدة عن طريق التأكد من تحديد متغير قبل محاولة الوصول إليه في التعليمات البرمجية. يمكن أن يساعد هذا في منع الأخطاء في أحد البرامج التي قد تحدث في حالة محاولة الوصول إلى متغير لم يتم تعريفه. - `function(x){ - if (typeof(x) === 'undefined') { - console.log('variable x is not defined'); - return; - } - // continue with function here... - } -` +```javascript +function(x){ + if (typeof(x) === 'undefined') { + console.log('variable x is not defined'); + return; + } + // continue with function here... +} +``` قد لا يكون ناتج عامل التشغيل `typeof` دائمًا ما تتوقعه عند التحقق من وجود رقم. يمكن أن تتحول الأرقام إلى قيمة [NaN (ليس رقم)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) لأسباب متعددة. - `console.log(typeof NaN); //"number" -` +```javascript +console.log(typeof NaN); //"number" +``` ربما حاولت ضرب رقم مع كائن لأنك نسيت الوصول إلى الرقم داخل الكائن. - `var x = 1; - var y = { number: 2 }; - console.log(x * y); // NaN - console.log(typeof (x * y)); // number -` +```javascript +var x = 1; +var y = { number: 2 }; +console.log(x * y); // NaN +console.log(typeof (x * y)); // number +``` عند التحقق من وجود رقم ، لا يكفي التحقق من إخراج `typeof` لرقم ، لأن `NaN` أيضًا يمر هذا الاختبار. تحقق هذه الوظيفة من الأرقام ، ولا تسمح أيضًا لقيمة `NaN` بالمرور. - `function isNumber(data) { - return (typeof data === 'number' && !isNan(data)); - } -` +```javascript +function isNumber(data) { + return (typeof data === 'number' && !isNan(data)); +} +``` حتى ظننا أن هذه طريقة تحقق مفيدة ، يجب أن نكون حذرين لأن javascript يحتوي على بعض الأجزاء الغريبة وأحدها هو نتيجة `typeof` على تعليمات معينة. على سبيل المثال ، في javascript ، هناك الكثير من الأشياء `objects` يمكنك العثور عليها فقط. - `var x = [1,2,3,4]; - console.log(typeof x) // object - - console.log(typeof null) // object -` +```javascript +var x = [1,2,3,4]; +console.log(typeof x) // object + +console.log(typeof null) // object +``` ### معلومات اكثر: diff --git a/guide/arabic/javascript/where-to/index.md b/guide/arabic/javascript/where-to/index.md index c26f2f78ce..f6b285a347 100644 --- a/guide/arabic/javascript/where-to/index.md +++ b/guide/arabic/javascript/where-to/index.md @@ -8,11 +8,11 @@ JavaScript هي لغة برمجة HTML والويب. في HTML ، يجب إدر ### مثال - ` - -` +```html + +``` تذكر أيضًا أنه يمكنك وضع أي عدد من علامات ` - - - - -