Front end darsliklari moduli html, css, javascript
Download 105,45 Kb.
|
FRONT END full notes (7) (2022 05 08 17 42 47 UTC)
- Bu sahifa navigatsiya:
- 4. JAVASCRIPT – Konstruktiv funksiyalar va date obekti
2. JAVASCRIPT – Data types
• Math ( .round, .pow, .sqrt, .abs, .ceil, .floor, .min, .max, .random) • condition operation ( ==, ===, >,<, >=,, && , ++, --) farqlari solishtirish… • exercise… parseInt(binary, 2) —> binary to int Number(42).toString(2); //101010 —> int to binary 3. JAVASCRIPT – String • String Nima? • String yozilish turları ( ‘ ’, “ ”, ` `); • str —> str[1]===str.charAt(1), concat(str) , +
const str1 = '5'; console.log(str1.padEnd(4, '0')); console.log(str1.padStart(4, '0')); // first is length, second is the value to place
4. JAVASCRIPT – Konstruktiv funksiyalar va date obekti • Functions nima? • Functions && Arrow functions return and without return parametrs, default parametrs function multiply(a, b = 1) { return a * b; } • Recursive functions // program to count down numbers to 1 function countDown(number) { // display the number console.log(number); // decrease the number value const newNumber = number - 1; // base case if (newNumber > 0) { countDown(newNumber); } } countDown(4); // program to find the factorial of a number function factorial(x) { // if number is 0 if (x === 0) { return 1; } // if number is positive else { return x * factorial(x - 1); } } const d = new Date("2015-03-25"); const d = new Date("2015"); const d = new Date("03/25/2015"); getFullYear() Get the year as a four digit number (yyyy) getMonth() Get the month as a number (0-11) getDate() Get the day as a number (1-31) getHours() Get the hour (0-23) getMinutes() Get the minute (0-59) getSeconds() Get the second (0-59) getMilliseconds() Get the millisecond (0-999) getTime() Get the time (milliseconds since January 1, 1970) getDay() Get the weekday as a number (0-6) Date.now() Get the time in milliseoncds. ECMAScript 5. setDate() Set the day as a number (1-31) setFullYear() Set the year (optionally month and day) setHours() Set the hour (0-23) setMilliseconds() Set the milliseconds (0-999) setMinutes() Set the minutes (0-59) setMonth() Set the month (0-11) setSeconds() Set the seconds (0-59) setTime() Set the time (milliseconds since January 1, 1970) //get tomorrow const date = new Date() const tomorrowInDays = date.setDate(date.getDate() + 1) new Date(tomorrowInDays) Download 105,45 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2025
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling