|
46 | 46 |
|
47 | 47 | بخاطر سپردن این نامها مفید هستند، چراکه در مقالات مختلف به آنها بر خواهید خورد، همینطور زمانیکه ما در این آموزش برای نمونه میگوییم ویژگی X توسط موتور **V8** پشتیبانی میشود، یعنی به احتمال زیاد در مرورگرهای کروم و اپرا پشتیبانی خواهد شد. |
48 | 48 |
|
| 49 | +<<<<<<< HEAD |
49 | 50 |
|
| 51 | +======= |
| 52 | +1. The engine (embedded if it's a browser) reads ("parses") the script. |
| 53 | +2. Then it converts ("compiles") the script to machine code. |
| 54 | +3. And then the machine code runs, pretty fast. |
| 55 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
50 | 56 |
|
51 | 57 | **موتورها** **چگونه کار** **میکنند** |
52 | 58 |
|
53 | 59 | موتورها پیچیده هستند، ولی اساس آنها ساده است. |
54 | 60 |
|
| 61 | +<<<<<<< HEAD |
55 | 62 | ۱. موتور در ابتدا اِسکریپت را میخواند (Parse). |
| 63 | +======= |
| 64 | +Modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or the CPU, because it was initially created for browsers which do not require it. |
| 65 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
56 | 66 |
|
57 | 67 | ۲. سپس آن را به زبان ماشین ترجمه میکند (Compile). |
58 | 68 |
|
|
64 | 74 |
|
65 | 75 |
|
66 | 76 |
|
| 77 | +<<<<<<< HEAD |
67 | 78 | ## جاوا اِسکریپت در مرورگر چه تواناییهایی دارد ؟ |
| 79 | +======= |
| 80 | +JavaScript's abilities in the browser are limited to protect the user's safety. The aim is to prevent an evil webpage from accessing private information or harming the user's data. |
| 81 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
68 | 82 |
|
69 | 83 |
|
70 | 84 |
|
71 | 85 | جاوا اِسکریپت مدرن زبانیست امن. این زبان اجازه دسترسی در سطوح پایین مانند درسترسی به حافظه (Memory) و پردازنده (CPU) را نمیدهد، چراکه از ابتدا برای مرورگرها (که نیازی به این موراد ندارند) ساخته شده بود. |
72 | 86 |
|
73 | 87 |
|
74 | 88 |
|
| 89 | +<<<<<<< HEAD |
75 | 90 | قابلیتهای جاوا اِسکریپت کاملا به محیطی که در آن اجرا میشود بستگی دارد. برای نمونه با جاوا اِسکریپت در [Node.JS](https://wikipedia.org/wiki/Node.js) میتوان عملیات خواندن و نوشتن (Read/Write) روی فایلها را انجام داد، و یا در شبکه درخواستهایی ارسال و دریافت کرد، و دیگر موارد. |
76 | 91 |
|
77 | 92 |
|
78 | 93 |
|
79 | 94 | در مرورگر جاوا اِسکریپت میتواند تمامی تعمالات لازم با کاربر و وبسِرور را انجام دهد. |
| 95 | +======= |
| 96 | + There are ways to interact with the camera/microphone and other devices, but they require a user's explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the [NSA](https://en.wikipedia.org/wiki/National_Security_Agency). |
| 97 | +- Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other page if they come from different sites (from a different domain, protocol or port). |
| 98 | + |
| 99 | + This is called the "Same Origin Policy". To work around that, *both pages* must agree for data exchange and must contain special JavaScript code that handles it. We'll cover that in the tutorial. |
| 100 | + |
| 101 | + This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com`, for example, and steal information from there. |
| 102 | +- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation. |
| 103 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
80 | 104 |
|
81 | 105 |
|
82 | 106 |
|
| 107 | +<<<<<<< HEAD |
83 | 108 | برای نمونه جاوا اِسکریپت در مرورگر میتواند : |
| 109 | +======= |
| 110 | +Such limitations do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow plugins/extensions which may ask for extended permissions. |
| 111 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
84 | 112 |
|
85 | 113 |
|
86 | 114 |
|
|
154 | 182 |
|
155 | 183 | ## زبانهایی فراتر از جاوا اِسکریپت |
156 | 184 |
|
| 185 | +<<<<<<< HEAD |
157 | 186 |
|
| 187 | +======= |
| 188 | +That said, JavaScript can be used to create servers, mobile applications, etc. |
| 189 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
158 | 190 |
|
159 | 191 | سینتَکس (Syntax) جاوا اِسکریپت مورد نیاز هر کسی نیست و اشخاص مختلف به قابلیتهای متفاوتی نیاز دارند. چراکه نیازمندیهای هر پروژه متفاوت است. |
160 | 192 |
|
161 | 193 |
|
162 | 194 |
|
163 | 195 | اخیرا تعداد زیادی زبان بوجود آمدهاند که به جاوا اِسکریپت تبدیل (Transpile) شده، پیش از آنکه جاوا اِسکریپت در مرورگر اجرا شود. |
164 | 196 |
|
| 197 | +<<<<<<< HEAD |
165 | 198 |
|
| 199 | +======= |
| 200 | +So, recently a plethora of new languages appeared, which are *transpiled* (converted) to JavaScript before they run in the browser. |
| 201 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
166 | 202 |
|
167 | 203 | نمونههایی از این زبانها : |
168 | 204 |
|
|
172 | 208 | - [Dart](https://www.dartlang.org/) : که زبانی مستقل با موتور مربوط به خود بوده و در محیطهای غیر مرورگری (مانند نرمافزارهای موبایل) کار میکند. این زبان در ابتدا توسط گوگل معرفی شد تا جایگزینی برای جاوا اِسکریپت باشد. |
173 | 209 | - [Brython](https://brython.info/) یک ترانسپایلر پایتون به جاوا اسکریپت است که توسعه دهندگان را قادر می سازد برنامه هایی به زبان پایتون خالص بدون جاوا اسکریپت بنویسند. |
174 | 210 |
|
| 211 | +<<<<<<< HEAD |
175 | 212 | ## خلاصه |
176 | 213 |
|
177 | 214 | - [CoffeeScript](https://coffeescript.org/) یک «syntactic sugar(سینتکس راحتتر)» برای جاوااسکریپت است. این زبان سینتکس کوتاهتری را معرفی میکند که به ما اجازه نوشتن کدی تمیزتر و دقیقتر را میدهد. معمولا، توسعهدهندگان زبان Ruby آن را دوست دارند. |
|
180 | 217 | - [Dart](https://www.dartlang.org/) یک زبان مستقل است که موتور خود را دارد که در محیطهای غیر مرورگر اجرا میشود (مانند اپهای موبایل) اما میتواند به جاوااسکریپت هم ترجمه شود. توسط گوگل توسعه داده شده است. |
181 | 218 | - [Brython](https://brython.info/) یک مترجم پایتون به جاوااسکریپت است که نوشتن یک برنامه به طور کامل در زبان پایتون را بدون جاوااسکریپت مقدور میسازد. |
182 | 219 | - [Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) یک زبان برنامهنویسی مدرن، مختصر و امن است که میتواند مرورگر یا Node را مورد هدف قرار دهد. |
| 220 | +======= |
| 221 | +- [CoffeeScript](https://coffeescript.org/) is "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it. |
| 222 | +- [TypeScript](https://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft. |
| 223 | +- [Flow](https://flow.org/) also adds data typing, but in a different way. Developed by Facebook. |
| 224 | +- [Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google. |
| 225 | +- [Brython](https://brython.info/) is a Python transpiler to JavaScript that enables the writing of applications in pure Python without JavaScript. |
| 226 | +- [Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) is a modern, concise and safe programming language that can target the browser or Node. |
| 227 | + |
| 228 | +There are more. Of course, even if we use one of these transpiled languages, we should also know JavaScript to really understand what we're doing. |
| 229 | +>>>>>>> 1edb0a38330b54d2e1916f5193fc043e6fbbea78 |
183 | 230 |
|
184 | 231 | - جاوا اِسکریپت در ابتدا برای مرورگرها ساخته شده بود ولی در حال حاضر در محیطهای متفاوتی قابلیت اجرا دارد. |
185 | 232 | - جاوا اِسکریپت در شرایط حاضر موقعیت مشخص و منحصر بفردی در زبانهای تحت مرورگرها دارد که تطابق کاملی با HTML و CSS را دارا میباشد. |
|
0 commit comments