ru
Feedback
studio amozesh | صفر تا صد برنامه نویسی

studio amozesh | صفر تا صد برنامه نویسی

Открыть в Telegram

اگر دوست داری وارد دنیای برنامه نویسی بشی ولی نمیدونی از کجا شروع کنی با من همراه باش تا کامل بهت یاد بدم 🔥 وب سایت : https://studioamozesh.com لینک گروه : @studioAmozeshGroup مدیریت | نقد و انتقادات | تبلیغات @khosroshahi23

Больше
2 045
Подписчики
Нет данных24 часа
-17 дней
-3530 дней
Архив постов
\n\n\n\n\n// script.js\n\nlet randomNumber;\nlet attempts = 0;\n\nfunction startGame() {\n    randomNumber = Math.floor(Math.random() * 100) + 1; // عدد تصادفی بین ۱ تا ۱۰۰\n    attempts = 0;\n    document.getElementById(\"resultMessage\").textContent = \"\";\n    document.getElementById(\"guessInput\").value = \"\";\n    document.getElementById(\"restartButton\").style.display = \"none\";\n}\n\ndocument.getElementById(\"submitGuess\").addEventListener(\"click\", function() {\n    const guess = Number(document.getElementById(\"guessInput\").value);\n    attempts++;\n\n    if (guess === randomNumber) {\n        document.getElementById(\"resultMessage\").textContent = تبریک! شما عدد ${randomNumber} را در ${attempts} تلاش حدس زدید.;\n        document.getElementById(\"restartButton\").style.display = \"inline\";\n    } else if (guess < randomNumber) {\n        document.getElementById(\"resultMessage\").textContent = \"عدد بزرگتر است!\";\n    } else {\n        document.getElementById(\"resultMessage\").textContent = \"عدد کوچکتر است!\";\n    }\n});\n\n// شروع بازی هنگام بارگذاری صفحه\nstartGame();\n\n// شروع دوباره بازی\ndocument.getElementById(\"restartButton\").addEventListener(\"click\", startGame);\n\n\n\n🌀HTML: ما یک ورودی برای دریافت حدس کاربر، یک دکمه برای ارسال حدس و یک پیام برای نمایش نتیجه داریم. همچنین یک دکمه برای شروع دوباره بازی نیز در نظر گرفته‌ایم.\n🌀جاوا اسکریپت\n  تابع startGame یک عدد تصادفی بین ۱ تا ۱۰۰ تولید می‌کند و تعداد تلاش‌ها را صفر می‌کند.\n  هنگامی که کاربر دکمه \"حدس بزنید\" را فشار می‌دهد، حدس کاربر بررسی می‌شود و پیام مناسب نمایش داده می‌شود.\n  اگر کاربر عدد صحیح را حدس بزند پیام تبریک نمایش داده می‌شود و دکمه \"شروع دوباره\" فعال می‌شود.\n\n\n#جاوا_اسکریپت \n#game\n\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-05T13:31:23Z","dateModified":"2024-08-05T13:31:23Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":1,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":379},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":11},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":5},{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1}]}},{"@type":"ListItem","position":8,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1330","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1330","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1330","headline":"اگر کار می‌کنه بهش دست نزنید 😁 #fun با حمایت خودتون انرژی بدید ♥️ ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website ꧂","articleBody":"اگر کار می‌کنه بهش دست نزنید 😁\n\n\n#fun\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-05T11:30:21Z","dateModified":"2024-08-05T11:30:21Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":1,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":322},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":9},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":2},{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1}]}},{"@type":"ListItem","position":9,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1329","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1329","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1329","headline":"🔰کلاس ها در جاوا اسکریپت(قسمت ششم): 🌀متدهای سازنده چندگانه در جاوا اسکریپت، نمی‌توان چندین سازنده برای یک کلا…","articleBody":"🔰کلاس ها در جاوا اسکریپت(قسمت ششم):\n\n\n🌀متدهای سازنده چندگانه\n\nدر جاوا اسکریپت، نمی‌توان چندین سازنده برای یک کلاس تعریف کرد. اما می‌توانیم از پارامترهای پیش‌فرض یا متدهای استاتیک برای شبیه‌سازی این رفتار استفاده کنیم.\n\nclass Rectangle {\n    constructor(width, height = width) { // ارتفاع پیش‌فرض برابر با عرض\n        this.width = width;\n        this.height = height;\n    }\n\n    area() {\n        return this.width * this.height;\n    }\n}\n\nconst rect1 = new Rectangle(10, 20);\nconsole.log(rect1.area()); // خروجی: 200\n\nconst rect2 = new Rectangle(10);\nconsole.log(rect2.area()); // خروجی: 100\n\n#جاوا_اسکریپت \n#class\n\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-05T07:30:33Z","dateModified":"2024-08-05T07:30:33Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":358},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":12},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":3}]}},{"@type":"ListItem","position":10,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1328","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1328","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1328","headline":"studio amozesh | صفر تا صد برنامه نویسی","datePublished":"2024-08-04T15:30:46Z","dateModified":"2024-08-04T15:30:46Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":3,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":364},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":12},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":1},{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3}]}},{"@type":"ListItem","position":11,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1327","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1327","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1327","headline":"کد زیر چه خروجی‌ای خواهد داشت؟ const arr = [1, 2, 3]; arr[10] = 11; console.log(arr.length);","articleBody":"کد زیر چه خروجی‌ای خواهد داشت؟\n  \n   const arr = [1, 2, 3];\n   arr[10] = 11;\n   console.log(arr.length);","datePublished":"2024-08-04T15:30:46Z","dateModified":"2024-08-04T15:30:46Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":377},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":1}]}},{"@type":"ListItem","position":12,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1326","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1326","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1326","headline":"🔰طراحی بازی Snake (مار) با جاوا اسکریپت \n\n\n    \n    \n    بازی مار\n    \n\n\n\n\n\n\n\n\n\nconst canvas = document.getElementById('gameCanvas');\nconst ctx = canvas.getContext('2d');\n\nlet snake = [{ x: 10, y: 10 }];\nlet direction = { x: 1, y: 0 };\nlet food = { x: 15, y: 15 };\nlet score = 0;\n\nfunction drawSnake() {\n    ctx.fillStyle = 'green';\n    for (let segment of snake) {\n        ctx.fillRect(segment.x * 20, segment.y * 20, 18, 18);\n    }\n}\n\nfunction drawFood() {\n    ctx.fillStyle = 'red';\n    ctx.fillRect(food.x * 20, food.y * 20, 18, 18);\n}\n\nfunction update() {\n    const head = { x: snake[0].x + direction.x, y: snake[0].y + direction.y };\n    \n    // Check for collision with food\n    if (head.x === food.x && head.y === food.y) {\n        score++;\n        snake.unshift(head);\n        spawnFood();\n    } else {\n        snake.unshift(head);\n        snake.pop();\n    }\n\n    // Check for collision with walls or self\n    if (head.x < 0 || head.x >= canvas.width / 20 || head.y < 0 || head.y >= canvas.height / 20 || collisionWithSelf(head)) {\n        alert(بازی تمام شد! امتیاز شما: ${score});\n        document.location.reload();\n    }\n}\n\nfunction collisionWithSelf(head) {\n    for (let segment of snake) {\n        if (segment.x === head.x && segment.y === head.y) {\n            return true;\n        }\n    }\n    return false;\n}\n\nfunction spawnFood() {\n    food.x = Math.floor(Math.random() * (canvas.width / 20));\n    food.y = Math.floor(Math.random() * (canvas.height / 20));\n}\n\nfunction changeDirection(event) {\n    switch (event.key) {\n        case 'ArrowUp':\n            if (direction.y !== 1) direction = { x: 0, y: -1 };\n            break;\n        case 'ArrowDown':\n            if (direction.y !== -1) direction = { x: 0, y: 1 };\n            break;\n        case 'ArrowLeft':\n            if (direction.x !== 1) direction = { x: -1, y: 0 };\n            break;\n        case 'ArrowRight':\n            if (direction.x !== -1) direction = { x: 1, y: 0 };\n            break;\n    }\n}\n\nfunction gameLoop() {\n    ctx.clearRect(0, 0, canvas.width, canvas.height);\n    drawSnake();\n    drawFood();\n    update();\n}\n\ndocument.addEventListener('keydown', changeDirection);\nsetInterval(gameLoop, 100);\n\n\n\n\nبا اجرای این کد شما یک بازی ساده Snake خواهید داشت که می‌توانید با استفاده از کلیدهای جهتی آن را کنترل کنید. اگر مار به دیواره‌ها یا خودش برخورد کند بازی تمام می‌شود و امتیاز شما نمایش داده می‌شود.\n\n#جاوا_اسکریپت \n#game\n\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-04T13:31:22Z","dateModified":"2024-08-04T13:31:22Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":369},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":12},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":9}]}},{"@type":"ListItem","position":13,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1325","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1325","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1325","headline":"🔰بهترین ابزارهای هوش مصنوعی برای ویرایش صدا!! 1⃣ سرویس Adobe Podcast : 🌀یک ابزار ضبط و ویرایش صدا مبتنی بر وب…","articleBody":"🔰بهترین ابزارهای هوش مصنوعی برای ویرایش صدا!!\n\n1⃣ سرویس Adobe Podcast :\n\n🌀یک ابزار ضبط و ویرایش صدا مبتنی بر وب است که از هوش مصنوعی برای بهبود کیفیت صدای شما استفاده می‌کند.\n\n\n2⃣ سرویس LANDR :\n\n🌀یک ابزار هوش مصنوعی صوتی کامل است که به شما اجازه می‌دهد موسیقی موردنظر خود را ایجاد کنید و آن را توزیع و تبلیغ کنید.\n\n\n3⃣ سرویس LALAL.AI : \n\n🌀ابزار هوش مصنوعی است که در زمینه برش و تقسیم بخش‌های مختلف محتوا تخصص دارد. در واقع با کمک این ابزار کاربران می‌توانند بخش‌های جداگانه از یک صدا یا ویدیو را استخراج کنند\n\n#کاربردی\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-04T11:30:50Z","dateModified":"2024-08-04T11:30:50Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":314},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":10},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":9}]}},{"@type":"ListItem","position":14,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1324","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1324","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1324","headline":"🔰کلاس ها در جاوا اسکریپت(قسمت پنجم): 🌀ویژگی‌های خصوصی (Private Fields) از ES2022 به بعد، می‌توان ویژگی‌های خص…","articleBody":"🔰کلاس ها در جاوا اسکریپت(قسمت پنجم):\n\n\n🌀ویژگی‌های خصوصی (Private Fields)\n\nاز ES2022 به بعد، می‌توان ویژگی‌های خصوصی را با استفاده از علامت # تعریف کرد. این ویژگی‌ها فقط در داخل کلاس قابل دسترسی هستند.\n\n\nclass BankAccount {\n    #balance; // ویژگی خصوصی\n\n    constructor(initialBalance) {\n        this.#balance = initialBalance;\n    }\n\n    deposit(amount) {\n        this.#balance += amount;\n    }\n\n    getBalance() {\n        return this.#balance;\n    }\n}\n\nconst account = new BankAccount(100);\naccount.deposit(50);\nconsole.log(account.getBalance()); // خروجی: 150\n// console.log(account.#balance); // خطا: Cannot access private field\n#جاوا_اسکریپت \n#class \n\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-04T07:30:49Z","dateModified":"2024-08-04T07:30:49Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":331},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":13},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":4}]}},{"@type":"ListItem","position":15,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1323","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1323","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1323","headline":"🔰طراحی کامل قالب یک وبسایت با html css #html #css با حمایت خودتون انرژی بدید ♥️ ➖➖➖➖➖➖➖➖➖ ꧁ channel | group |…","articleBody":"🔰طراحی کامل قالب یک وبسایت با html css\n\n#html\n#css\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-03T15:29:49Z","dateModified":"2024-08-03T15:29:49Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":1044},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":12},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":40}]}},{"@type":"ListItem","position":16,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1322","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1322","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1322","headline":"🔰ساخت بازی دوز با جاوا اسکریپت \n\n\n    \n    \n    بازی دوز\n    \n\n\n   

بازی دوز

\n   
\n    \n    \n\n\n\nbody {\n    font-family: Arial, sans-serif;\n    text-align: center;\n}\n\n#board {\n    display: grid;\n    grid-template-columns: repeat(3, 100px);\n    grid-template-rows: repeat(3, 100px);\n    gap: 5px;\n    margin: 20px auto;\n}\n\n.cell {\n    width: 100px;\n    height: 100px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    font-size: 24px;\n    border: 1px solid #000;\n    cursor: pointer;\n}\n\n.cell:hover {\n    background-color: #f0f0f0;\n}\n\n\nconst board = document.getElementById('board');\nconst restartButton = document.getElementById('restart');\nlet currentPlayer = 'X';\nlet gameActive = true;\nlet gameState = ['', '', '', '', '', '', '', '', ''];\n\n// ایجاد سلول‌ها\nfunction createCell(index) {\n    const cell = document.createElement('div');\n    cell.classList.add('cell');\n    cell.setAttribute('data-index', index);\n    cell.addEventListener('click', handleCellClick);\n    board.appendChild(cell);\n}\n\n// مدیریت کلیک روی سلول‌ها\nfunction handleCellClick(event) {\n    const index = event.target.getAttribute('data-index');\n\n    if (gameState[index] !== '' || !gameActive) {\n        return;\n    }\n\n    gameState[index] = currentPlayer;\n    event.target.textContent = currentPlayer;\n\n    checkResult();\n}\n\n// بررسی نتیجه بازی\nfunction checkResult() {\n    const winningConditions = [\n        [0, 1, 2],\n        [3, 4, 5],\n        [6, 7, 8],\n        [0, 3, 6],\n        [1, 4, 7],\n        [2, 5, 8],\n        [0, 4, 8],\n        [2, 4, 6]\n    ];\n\n    for (let condition of winningConditions) {\n        const [a, b, c] = condition;\n        if (gameState[a] && gameState[a] === gameState[b] && gameState[a] === gameState[c]) {\n            alert(بازیکن ${currentPlayer} برنده شد!);\n            gameActive = false;\n            return;\n        }\n    }\n\n    if (!gameState.includes('')) {\n        alert('بازی مساوی شد!');\n        gameActive = false;\n    }\n\n    currentPlayer = currentPlayer === 'X' ? 'O' : 'X';\n}\n\n// راه‌اندازی بازی\nfunction startGame() {\n    gameActive = true;\n    currentPlayer = 'X';\n    gameState = ['', '', '', '', '', '', '', '', ''];\n    board.innerHTML = '';\n    \n    for (let i = 0; i < 9; i++) {\n        createCell(i);\n    }\n}\n\n// راه‌اندازی مجدد بازی\nrestartButton.addEventListener('click', startGame);\n\n// شروع بازی\nstartGame();\n\n\n\n\n🌀 در این کد، ما یک تخته بازی با استفاده از HTML و CSS ایجاد کردیم و منطق بازی را با استفاده از جاوا اسکریپت پیاده‌سازی کردیم.\nبا کلیک بر روی هر سلول، بازیکن فعلی علامت خود را (X یا O) قرار می‌دهد و سپس بررسی می‌شود که آیا یکی از بازیکنان برنده شده است یا خیر.\nهمچنین دکمه‌ای برای شروع دوباره بازی اضافه شده است.\n\nشما می‌توانید این کد را در مرورگر خود اجرا کنید و بازی دوز را تجربه کنید!\n\n\n#جاوا_اسکریپت\n\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-03T13:30:46Z","dateModified":"2024-08-03T13:30:46Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":375},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":11},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":9}]}},{"@type":"ListItem","position":17,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1321","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1321","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1321","headline":"🔰ساخت بازی دوز با جاوا اسکریپت \n\n\n    \n    \n    بازی دوز\n    \n\n\n   

بازی دوز

\n   
\n    \n    \n\n\n\nbody {\n    font-family: Arial, sans-serif;\n    text-align: center;\n}\n\n#board {\n    display: grid;\n    grid-template-columns: repeat(3, 100px);\n    grid-template-rows: repeat(3, 100px);\n    gap: 5px;\n    margin: 20px auto;\n}\n\n.cell {\n    width: 100px;\n    height: 100px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    font-size: 24px;\n    border: 1px solid #000;\n    cursor: pointer;\n}\n\n.cell:hover {\n    background-color: #f0f0f0;\n}\n\n\nconst board = document.getElementById('board');\nconst restartButton = document.getElementById('restart');\nlet currentPlayer = 'X';\nlet gameActive = true;\nlet gameState = ['', '', '', '', '', '', '', '', ''];\n\n// ایجاد سلول‌ها\nfunction createCell(index) {\n    const cell = document.createElement('div');\n    cell.classList.add('cell');\n    cell.setAttribute('data-index', index);\n    cell.addEventListener('click', handleCellClick);\n    board.appendChild(cell);\n}\n\n// مدیریت کلیک روی سلول‌ها\nfunction handleCellClick(event) {\n    const index = event.target.getAttribute('data-index');\n\n    if (gameState[index] !== '' || !gameActive) {\n        return;\n    }\n\n    gameState[index] = currentPlayer;\n    event.target.textContent = currentPlayer;\n\n    checkResult();\n}\n\n// بررسی نتیجه بازی\nfunction checkResult() {\n    const winningConditions = [\n        [0, 1, 2],\n        [3, 4, 5],\n        [6, 7, 8],\n        [0, 3, 6],\n        [1, 4, 7],\n        [2, 5, 8],\n        [0, 4, 8],\n        [2, 4, 6]\n    ];\n\n    for (let condition of winningConditions) {\n        const [a, b, c] = condition;\n        if (gameState[a] && gameState[a] === gameState[b] && gameState[a] === gameState[c]) {\n            alert(بازیکن ${currentPlayer} برنده شد!);\n            gameActive = false;\n            return;\n        }\n    }\n\n    if (!gameState.includes('')) {\n        alert('بازی مساوی شد!');\n        gameActive = false;\n    }\n\n    currentPlayer = currentPlayer === 'X' ? 'O' : 'X';\n}\n\n// راه‌اندازی بازی\nfunction startGame() {\n    gameActive = true;\n    currentPlayer = 'X';\n    gameState = ['', '', '', '', '', '', '', '', ''];\n    board.innerHTML = '';\n    \n    for (let i = 0; i < 9; i++) {\n        createCell(i);\n    }\n}\n\n// راه‌اندازی مجدد بازی\nrestartButton.addEventListener('click', startGame);\n\n// شروع بازی\nstartGame();\n\n\n\n🌀 در این کد، ما یک تخته بازی با استفاده از HTML و CSS ایجاد کردیم و منطق بازی را با استفاده از جاوا اسکریپت پیاده‌سازی کردیم.\nبا کلیک بر روی هر سلول، بازیکن فعلی علامت خود را (X یا O) قرار می‌دهد و سپس بررسی می‌شود که آیا یکی از بازیکنان برنده شده است یا خیر.\nهمچنین دکمه‌ای برای شروع دوباره بازی اضافه شده است.\n\nشما می‌توانید این کد را در مرورگر خود اجرا کنید و بازی دوز را تجربه کنید!\n\n\n#جاوا_اسکریپت\n\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-03T12:46:50Z","dateModified":"2024-08-03T12:46:57Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":1}]}},{"@type":"ListItem","position":18,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1320","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1320","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1320","headline":"🔰 برای تمرین برنامه‌نویسی یه سر به اینا بزن! ▪️سایت آوردم واست که هرکدوم یه عالمه تمرین برنامه نویسی توش هست…","articleBody":"🔰 برای تمرین برنامه‌نویسی یه سر به اینا بزن!\n\n▪️سایت آوردم واست که هرکدوم یه عالمه تمرین برنامه نویسی توش هست ؛ مهم نیست چه زبانی کار میکنی ، این سایتا تقریباً از تمامی زبان های برنامه نویسی پشتیبانی میکنن.\n\n1⃣ سایت اول : leetcode \n\n🌀این سایت به شما سوال برنامه نویسی میده و محیطی رو هم اختصاص داده برای نوشتن کدهای شما ؛ از 14 زبان برنامه‌نویسی پشتیبانی میکنه و بیش 3.500 سوال داره.\n\n2⃣ سایت دوم : hackerrank\n\n🌀این سایت براساس دسته‌بندیی که شما انتخاب میکنید یک عالمه سوال برنامه نویسی بهتون نمایش میده ؛ درجه بندی سوال هم داره و میتونید به ترتیب سختی اونارو مرتب کنید.\n\n3⃣ سایت سوم : codesignal\n\n🌀این سایت هم مشابه دو سایت قبلی کلی سوال بهتون میده فقط فرقش اینه که برای خیلی از پاسخ‌هاش ویدیو آپلود کرده و سعی میکنه با عکس و انیمیشن پاسخ سوالاتش رو بده.\n\n#کاربردی\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-03T11:31:26Z","dateModified":"2024-08-03T11:31:26Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":368},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":11},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":30}]}},{"@type":"ListItem","position":19,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1319","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1319","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1319","headline":"🔰کلاس ها در جاوا اسکریپت(قسمت چهارم): 🌀متدهای استاتیک (Static Methods) متدهای استاتیک متدهایی هستند که به کلا…","articleBody":"🔰کلاس ها در جاوا اسکریپت(قسمت چهارم):\n\n\n🌀متدهای استاتیک (Static Methods)\n\nمتدهای استاتیک متدهایی هستند که به کلاس تعلق دارند و نه به نمونه‌های آن. این متدها با استفاده از کلمه کلیدی static تعریف می‌شوند.\n\n\nclass MathUtil {\n    static add(a, b) {\n        return a + b;\n    }\n}\n\nconsole.log(MathUtil.add(5, 10)); // خروجی: 15\n#جاوا_اسکریپت \n#class\n\n\nبا حمایت خودتون انرژی بدید ♥️\n\n        ➖➖➖➖➖➖➖➖➖\n꧁ channel | group | website ꧂","datePublished":"2024-08-03T07:30:50Z","dateModified":"2024-08-03T07:30:50Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":355},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":10},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":3}]}},{"@type":"ListItem","position":20,"item":{"@type":"SocialMediaPosting","@id":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1318","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1318","mainEntityOfPage":"https://telemetr.io/ru/channels/1507787918-studio_amozesh/posts/1318","headline":"7 تا Api رایگان برای پروژه های خودتون 😎 #pdf با حمایت خودتون انرژی بدید ♥️ ➖➖➖➖➖➖ ꧁channel | group꧂ studioamo…","articleBody":"7 تا Api رایگان برای پروژه های خودتون 😎\n\n#pdf\n\nبا حمایت خودتون انرژی بدید ♥️\n\n      ➖➖➖➖➖➖\n꧁channel | group꧂\n\nstudioamozesh.com","datePublished":"2024-08-02T15:31:02Z","dateModified":"2024-08-02T15:31:02Z","author":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"publisher":{"@type":"Organization","name":"studio amozesh | صفر تا صد برنامه نویسی","url":"https://telemetr.io/ru/channels/1507787918-studio_amozesh","image":"https://img.tlmtr.io/c/1E2wvY/6001174859025076193?ty=x"},"commentCount":0,"interactionStatistic":[{"@type":"InteractionCounter","interactionType":"https://schema.org/ViewAction","userInteractionCount":389},{"@type":"InteractionCounter","interactionType":"https://schema.org/LikeAction","userInteractionCount":6},{"@type":"InteractionCounter","interactionType":"https://schema.org/ShareAction","userInteractionCount":17}]}}]}
تفاوت سنیور با جونیور ها با رسم تصویر 😂 #fun با حمایت خودتون انرژی بدید ♥️ ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website ꧂
تفاوت سنیور با جونیور ها با رسم تصویر 😂 #fun با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰کلاس ها در جاوا اسکریپت(قسمت هشتم):```javascript ``` 🌀متدهای Getter و Setter متدهای Getter و Setter به ما این امکان را می‌دهند که به ویژگی‌های شیء دسترسی داشته باشیم و آن‌ها را تغییر دهیم به طوری که به نظر برسد که به صورت مستقیم با آن‌ها کار می‌کنیم.
class Circle {
    constructor(radius) {
        this._radius = radius; // استفاده از _ برای نشان دادن ویژگی خصوصی
    }

    get area() {
        return Math.PI * this._radius * this._radius;
    }

    set radius(newRadius) {
        if (newRadius > 0) {
            this._radius = newRadius;
        } else {
            console.error("شعاع باید بزرگتر از صفر باشد.");
        }
    }
}

const circle = new Circle(5);
console.log(circle.area); // خروجی: 78.53981633974483
circle.radius = 10; // تغییر شعاع
console.log(circle.area); // خروجی: 314.1592653589793
#جاوا_اسکریپت #class با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰طراحی های خلاقانه با html css #html #css با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

خدایی این برای تازه کار ها خیلی عذابه 😂 #fun با حمایت خودتون انرژی بدید ♥️ ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website ꧂
خدایی این برای تازه کار ها خیلی عذابه 😂 #fun با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰کلاس ها در جاوا اسکریپت(قسمت هفتم): 🌀متدهای سازنده و ارث‌بری زمانی که یک کلاس فرزند از یک کلاس والد ارث‌بری می‌کند، باید از super() برای فراخوانی سازنده کلاس والد استفاده کنیم. این کار باید قبل از دسترسی به this در سازنده کلاس فرزند انجام شود.
class Animal {
    constructor(name) {
        this.name = name;
    }

    speak() {
        console.log(${this.name} صدا می‌زند.);
    }
}

class Dog extends Animal {
    constructor(name, breed) {
        super(name); // فراخوانی سازنده کلاس والد
        this.breed = breed;
    }

    speak() {
        console.log(${this.name} یک ${this.breed} است و می‌گوید: Woof!);
    }
}

const dog = new Dog("برو", "لابرادور");
dog.speak(); // خروجی: برو یک لابرادور است و می‌گوید: Woof!
#جاوا_اسکریپت #class با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰طراحی های خلاقانه با html css #html #css با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰ساخت بازی حدس عدد با جاوا اسکریپت
<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>بازی حدس عدد</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            margin-top: 50px;
        }
        input {
            padding: 10px;
            font-size: 16px;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
        }
    </style>
</head>
<body>
    <h1>بازی حدس عدد</h1>
    <p>یک عدد بین ۱ تا ۱۰۰ را حدس بزنید:</p>
    <input type="number" id="guessInput" placeholder="عدد خود را وارد کنید" />
    <button id="submitGuess">حدس بزنید</button>
    <p id="resultMessage"></p>
    <button id="restartButton" style="display:none;">شروع دوباره</button>

    <script src="script.js"></script>
</body>
</html>
// script.js

let randomNumber;
let attempts = 0;

function startGame() {
    randomNumber = Math.floor(Math.random() * 100) + 1; // عدد تصادفی بین ۱ تا ۱۰۰
    attempts = 0;
    document.getElementById("resultMessage").textContent = "";
    document.getElementById("guessInput").value = "";
    document.getElementById("restartButton").style.display = "none";
}

document.getElementById("submitGuess").addEventListener("click", function() {
    const guess = Number(document.getElementById("guessInput").value);
    attempts++;

    if (guess === randomNumber) {
        document.getElementById("resultMessage").textContent = تبریک! شما عدد ${randomNumber} را در ${attempts} تلاش حدس زدید.;
        document.getElementById("restartButton").style.display = "inline";
    } else if (guess < randomNumber) {
        document.getElementById("resultMessage").textContent = "عدد بزرگتر است!";
    } else {
        document.getElementById("resultMessage").textContent = "عدد کوچکتر است!";
    }
});

// شروع بازی هنگام بارگذاری صفحه
startGame();

// شروع دوباره بازی
document.getElementById("restartButton").addEventListener("click", startGame);
🌀HTML: ما یک ورودی برای دریافت حدس کاربر، یک دکمه برای ارسال حدس و یک پیام برای نمایش نتیجه داریم. همچنین یک دکمه برای شروع دوباره بازی نیز در نظر گرفته‌ایم. 🌀جاوا اسکریپت   تابع startGame یک عدد تصادفی بین ۱ تا ۱۰۰ تولید می‌کند و تعداد تلاش‌ها را صفر می‌کند.   هنگامی که کاربر دکمه "حدس بزنید" را فشار می‌دهد، حدس کاربر بررسی می‌شود و پیام مناسب نمایش داده می‌شود.   اگر کاربر عدد صحیح را حدس بزند پیام تبریک نمایش داده می‌شود و دکمه "شروع دوباره" فعال می‌شود. #جاوا_اسکریپت #game با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

اگر کار می‌کنه بهش دست نزنید 😁 #fun با حمایت خودتون انرژی بدید ♥️ ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website ꧂
اگر کار می‌کنه بهش دست نزنید 😁 #fun با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰کلاس ها در جاوا اسکریپت(قسمت ششم): 🌀متدهای سازنده چندگانه در جاوا اسکریپت، نمی‌توان چندین سازنده برای یک کلاس تعریف کرد. اما می‌توانیم از پارامترهای پیش‌فرض یا متدهای استاتیک برای شبیه‌سازی این رفتار استفاده کنیم.
class Rectangle {
    constructor(width, height = width) { // ارتفاع پیش‌فرض برابر با عرض
        this.width = width;
        this.height = height;
    }

    area() {
        return this.width * this.height;
    }
}

const rect1 = new Rectangle(10, 20);
console.log(rect1.area()); // خروجی: 200

const rect2 = new Rectangle(10);
console.log(rect2.area()); // خروجی: 100
#جاوا_اسکریپت #class با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

خروجی کد بالا چیست؟
Anonymous voting

کد زیر چه خروجی‌ای خواهد داشت؟   
   const arr = [1, 2, 3];
   arr[10] = 11;
   console.log(arr.length);
  

🔰طراحی بازی Snake (مار) با جاوا اسکریپت
<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>بازی مار</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
        }
        canvas {
            border: 1px solid #000;
            background-color: #fff;
        }
    </style>
</head>
<body>

<canvas id="gameCanvas" width="400" height="400"></canvas>

<script src="script.js"></script>
</body>
</html>
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');

let snake = [{ x: 10, y: 10 }];
let direction = { x: 1, y: 0 };
let food = { x: 15, y: 15 };
let score = 0;

function drawSnake() {
    ctx.fillStyle = 'green';
    for (let segment of snake) {
        ctx.fillRect(segment.x * 20, segment.y * 20, 18, 18);
    }
}

function drawFood() {
    ctx.fillStyle = 'red';
    ctx.fillRect(food.x * 20, food.y * 20, 18, 18);
}

function update() {
    const head = { x: snake[0].x + direction.x, y: snake[0].y + direction.y };
    
    // Check for collision with food
    if (head.x === food.x && head.y === food.y) {
        score++;
        snake.unshift(head);
        spawnFood();
    } else {
        snake.unshift(head);
        snake.pop();
    }

    // Check for collision with walls or self
    if (head.x < 0 || head.x >= canvas.width / 20 || head.y < 0 || head.y >= canvas.height / 20 || collisionWithSelf(head)) {
        alert(بازی تمام شد! امتیاز شما: ${score});
        document.location.reload();
    }
}

function collisionWithSelf(head) {
    for (let segment of snake) {
        if (segment.x === head.x && segment.y === head.y) {
            return true;
        }
    }
    return false;
}

function spawnFood() {
    food.x = Math.floor(Math.random() * (canvas.width / 20));
    food.y = Math.floor(Math.random() * (canvas.height / 20));
}

function changeDirection(event) {
    switch (event.key) {
        case 'ArrowUp':
            if (direction.y !== 1) direction = { x: 0, y: -1 };
            break;
        case 'ArrowDown':
            if (direction.y !== -1) direction = { x: 0, y: 1 };
            break;
        case 'ArrowLeft':
            if (direction.x !== 1) direction = { x: -1, y: 0 };
            break;
        case 'ArrowRight':
            if (direction.x !== -1) direction = { x: 1, y: 0 };
            break;
    }
}

function gameLoop() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    drawSnake();
    drawFood();
    update();
}

document.addEventListener('keydown', changeDirection);
setInterval(gameLoop, 100);
با اجرای این کد شما یک بازی ساده Snake خواهید داشت که می‌توانید با استفاده از کلیدهای جهتی آن را کنترل کنید. اگر مار به دیواره‌ها یا خودش برخورد کند بازی تمام می‌شود و امتیاز شما نمایش داده می‌شود. #جاوا_اسکریپت #game با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰بهترین ابزارهای هوش مصنوعی برای ویرایش صدا!! 1⃣ سرویس Adobe Podcast : 🌀یک ابزار ضبط و ویرایش صدا مبتنی بر وب است که از هوش
🔰بهترین ابزارهای هوش مصنوعی برای ویرایش صدا!! 1⃣ سرویس Adobe Podcast : 🌀یک ابزار ضبط و ویرایش صدا مبتنی بر وب است که از هوش مصنوعی برای بهبود کیفیت صدای شما استفاده می‌کند. 2⃣ سرویس LANDR : 🌀یک ابزار هوش مصنوعی صوتی کامل است که به شما اجازه می‌دهد موسیقی موردنظر خود را ایجاد کنید و آن را توزیع و تبلیغ کنید. 3⃣ سرویس LALAL.AI : 🌀ابزار هوش مصنوعی است که در زمینه برش و تقسیم بخش‌های مختلف محتوا تخصص دارد. در واقع با کمک این ابزار کاربران می‌توانند بخش‌های جداگانه از یک صدا یا ویدیو را استخراج کنند #کاربردی با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰کلاس ها در جاوا اسکریپت(قسمت پنجم): 🌀ویژگی‌های خصوصی (Private Fields) از ES2022 به بعد، می‌توان ویژگی‌های خصوصی را با استفاده از علامت # تعریف کرد. این ویژگی‌ها فقط در داخل کلاس قابل دسترسی هستند.
class BankAccount {
    #balance; // ویژگی خصوصی

    constructor(initialBalance) {
        this.#balance = initialBalance;
    }

    deposit(amount) {
        this.#balance += amount;
    }

    getBalance() {
        return this.#balance;
    }
}

const account = new BankAccount(100);
account.deposit(50);
console.log(account.getBalance()); // خروجی: 150
// console.log(account.#balance); // خطا: Cannot access private field
#جاوا_اسکریپت #class با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰طراحی کامل قالب یک وبسایت با html css #html #css با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰ساخت بازی دوز با جاوا اسکریپت
<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>بازی دوز</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h1>بازی دوز</h1>
    <div id="board"></div>
    <button id="restart">شروع دوباره</button>
    <script src="script.js"></script>
</body>
</html>
body {
    font-family: Arial, sans-serif;
    text-align: center;
}

#board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 5px;
    margin: 20px auto;
}

.cell {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1px solid #000;
    cursor: pointer;
}

.cell:hover {
    background-color: #f0f0f0;
}
const board = document.getElementById('board');
const restartButton = document.getElementById('restart');
let currentPlayer = 'X';
let gameActive = true;
let gameState = ['', '', '', '', '', '', '', '', ''];

// ایجاد سلول‌ها
function createCell(index) {
    const cell = document.createElement('div');
    cell.classList.add('cell');
    cell.setAttribute('data-index', index);
    cell.addEventListener('click', handleCellClick);
    board.appendChild(cell);
}

// مدیریت کلیک روی سلول‌ها
function handleCellClick(event) {
    const index = event.target.getAttribute('data-index');

    if (gameState[index] !== '' || !gameActive) {
        return;
    }

    gameState[index] = currentPlayer;
    event.target.textContent = currentPlayer;

    checkResult();
}

// بررسی نتیجه بازی
function checkResult() {
    const winningConditions = [
        [0, 1, 2],
        [3, 4, 5],
        [6, 7, 8],
        [0, 3, 6],
        [1, 4, 7],
        [2, 5, 8],
        [0, 4, 8],
        [2, 4, 6]
    ];

    for (let condition of winningConditions) {
        const [a, b, c] = condition;
        if (gameState[a] && gameState[a] === gameState[b] && gameState[a] === gameState[c]) {
            alert(بازیکن ${currentPlayer} برنده شد!);
            gameActive = false;
            return;
        }
    }

    if (!gameState.includes('')) {
        alert('بازی مساوی شد!');
        gameActive = false;
    }

    currentPlayer = currentPlayer === 'X' ? 'O' : 'X';
}

// راه‌اندازی بازی
function startGame() {
    gameActive = true;
    currentPlayer = 'X';
    gameState = ['', '', '', '', '', '', '', '', ''];
    board.innerHTML = '';
    
    for (let i = 0; i < 9; i++) {
        createCell(i);
    }
}

// راه‌اندازی مجدد بازی
restartButton.addEventListener('click', startGame);

// شروع بازی
startGame();
🌀 در این کد، ما یک تخته بازی با استفاده از HTML و CSS ایجاد کردیم و منطق بازی را با استفاده از جاوا اسکریپت پیاده‌سازی کردیم. با کلیک بر روی هر سلول، بازیکن فعلی علامت خود را (X یا O) قرار می‌دهد و سپس بررسی می‌شود که آیا یکی از بازیکنان برنده شده است یا خیر. همچنین دکمه‌ای برای شروع دوباره بازی اضافه شده است. شما می‌توانید این کد را در مرورگر خود اجرا کنید و بازی دوز را تجربه کنید! #جاوا_اسکریپت با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰ساخت بازی دوز با جاوا اسکریپت
<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>بازی دوز</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h1>بازی دوز</h1>
    <div id="board"></div>
    <button id="restart">شروع دوباره</button>
    <script src="script.js"></script>
</body>
</html>
body {
    font-family: Arial, sans-serif;
    text-align: center;
}

#board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 5px;
    margin: 20px auto;
}

.cell {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1px solid #000;
    cursor: pointer;
}

.cell:hover {
    background-color: #f0f0f0;
}
const board = document.getElementById('board');
const restartButton = document.getElementById('restart');
let currentPlayer = 'X';
let gameActive = true;
let gameState = ['', '', '', '', '', '', '', '', ''];

// ایجاد سلول‌ها
function createCell(index) {
    const cell = document.createElement('div');
    cell.classList.add('cell');
    cell.setAttribute('data-index', index);
    cell.addEventListener('click', handleCellClick);
    board.appendChild(cell);
}

// مدیریت کلیک روی سلول‌ها
function handleCellClick(event) {
    const index = event.target.getAttribute('data-index');

    if (gameState[index] !== '' || !gameActive) {
        return;
    }

    gameState[index] = currentPlayer;
    event.target.textContent = currentPlayer;

    checkResult();
}

// بررسی نتیجه بازی
function checkResult() {
    const winningConditions = [
        [0, 1, 2],
        [3, 4, 5],
        [6, 7, 8],
        [0, 3, 6],
        [1, 4, 7],
        [2, 5, 8],
        [0, 4, 8],
        [2, 4, 6]
    ];

    for (let condition of winningConditions) {
        const [a, b, c] = condition;
        if (gameState[a] && gameState[a] === gameState[b] && gameState[a] === gameState[c]) {
            alert(بازیکن ${currentPlayer} برنده شد!);
            gameActive = false;
            return;
        }
    }

    if (!gameState.includes('')) {
        alert('بازی مساوی شد!');
        gameActive = false;
    }

    currentPlayer = currentPlayer === 'X' ? 'O' : 'X';
}

// راه‌اندازی بازی
function startGame() {
    gameActive = true;
    currentPlayer = 'X';
    gameState = ['', '', '', '', '', '', '', '', ''];
    board.innerHTML = '';
    
    for (let i = 0; i < 9; i++) {
        createCell(i);
    }
}

// راه‌اندازی مجدد بازی
restartButton.addEventListener('click', startGame);

// شروع بازی
startGame();
🌀 در این کد، ما یک تخته بازی با استفاده از HTML و CSS ایجاد کردیم و منطق بازی را با استفاده از جاوا اسکریپت پیاده‌سازی کردیم. با کلیک بر روی هر سلول، بازیکن فعلی علامت خود را (X یا O) قرار می‌دهد و سپس بررسی می‌شود که آیا یکی از بازیکنان برنده شده است یا خیر. همچنین دکمه‌ای برای شروع دوباره بازی اضافه شده است. شما می‌توانید این کد را در مرورگر خود اجرا کنید و بازی دوز را تجربه کنید! #جاوا_اسکریپت با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰 برای تمرین برنامه‌نویسی یه سر به اینا بزن! ▪️سایت آوردم واست که هرکدوم یه عالمه تمرین برنامه نویسی توش هست ؛ مهم نیست چه ز
🔰 برای تمرین برنامه‌نویسی یه سر به اینا بزن! ▪️سایت آوردم واست که هرکدوم یه عالمه تمرین برنامه نویسی توش هست ؛ مهم نیست چه زبانی کار میکنی ، این سایتا تقریباً از تمامی زبان های برنامه نویسی پشتیبانی میکنن. 1⃣ سایت اول : leetcode 🌀این سایت به شما سوال برنامه نویسی میده و محیطی رو هم اختصاص داده برای نوشتن کدهای شما ؛ از 14 زبان برنامه‌نویسی پشتیبانی میکنه و بیش 3.500 سوال داره. 2⃣ سایت دوم : hackerrank 🌀این سایت براساس دسته‌بندیی که شما انتخاب میکنید یک عالمه سوال برنامه نویسی بهتون نمایش میده ؛ درجه بندی سوال هم داره و میتونید به ترتیب سختی اونارو مرتب کنید. 3⃣ سایت سوم : codesignal 🌀این سایت هم مشابه دو سایت قبلی کلی سوال بهتون میده فقط فرقش اینه که برای خیلی از پاسخ‌هاش ویدیو آپلود کرده و سعی میکنه با عکس و انیمیشن پاسخ سوالاتش رو بده. #کاربردی با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

🔰کلاس ها در جاوا اسکریپت(قسمت چهارم): 🌀متدهای استاتیک (Static Methods) متدهای استاتیک متدهایی هستند که به کلاس تعلق دارند و نه به نمونه‌های آن. این متدها با استفاده از کلمه کلیدی static تعریف می‌شوند.
class MathUtil {
    static add(a, b) {
        return a + b;
    }
}

console.log(MathUtil.add(5, 10)); // خروجی: 15
#جاوا_اسکریپت #class با حمایت خودتون انرژی بدید ♥️         ➖➖➖➖➖➖➖➖➖ ꧁ channel | group | website

7 تا Api رایگان برای پروژه های خودتون 😎 #pdf با حمایت خودتون انرژی بدید ♥️       ➖➖➖➖➖➖ ꧁channel | groupstudioamozesh.com