JavaScript এর Array.of() পদ্ধতিটি প্যারামিটার মান হিসাবে ভেরিয়েবল সহ একটি নতুন অ্যারে উদাহরণ তৈরি করতে ব্যবহৃত হয়।
সিনট্যাক্স নিম্নরূপ -
Array.of(elements....)
উপরে, উপাদানগুলি পরামিতি মান হিসাবে মান।
এখন জাভাস্ক্রিপ্ট -
-এ Array.of() পদ্ধতি প্রয়োগ করা যাকউদাহরণ
<!DOCTYPE html>
<html>
<body>
<h2>Demo Heading</h2>
<p>Click the button to display the values in Console</p>
<button onclick="display()">Result</button>
<p id="test"></p>
<script>
function display() {
console.log(Array.of(10, 20, 30, 40 ,50));
}
</script>
</body>
</html> আউটপুট

"ফলাফল" এ ক্লিক করুন এবং আউটপুট -
-এর জন্য কনসোল চেক করুন

উদাহরণ
<!DOCTYPE html>
<html>
<body>
<h2>Demo Heading</h2>
<p>Get the student names with top 5 ranks...</p>
<button onclick="display()">Result</button>
<p id="test"></p>
<script>
function display() {
console.log(Array.of("Kevin", "Tom", "Ryan", "Jacob", "Jack"));
}
</script>
</body>
</html> আউটপুট

"ফলাফল" বোতামে ক্লিক করুন এবং কনসোলে ফলাফল চেক করুন -
