محاضرة 7
JavaScript Built-in Functions
التعامل مع الدوال الجاهزة للنصوص والمصفوفات والعمليات الحسابية.
يلا نشوف الملخص
Lecture 7: Built-in Functions in JavaScript
1. String Methods
- split(separator): Splits a string into an array of substrings based on a specified separator.
- charAt(index): Returns the character located at the specified index.
- toUpperCase(): Converts all characters in a string to uppercase.
- slice(start, end): Extracts a portion of a string and returns it as a new string.
2. Array Methods
- map(callback): Applies a function to each element of an array, creating a new array with the results.
- Example: Doubling numbers in an array.
3. Math Methods
- Math.pow(base, exponent): Calculates the value of a base raised to the power of an exponent.
- Math.sqrt(number): Returns the square root of a given number.
4. Practical Logic Examples
- Circle Area: Calculated using the formula $\pi \times r^2$ using
Math.pow(radius, 2). - Capitalizing Words: Involves splitting a sentence, using
mapto target the first character withcharAt(0).toUpperCase(), and joining the results back together.
في نقطة مش واضحة؟ بطبط موجود!
اسأل بطبط عنها