নিউলাইন ক্যারেক্টারগুলোকে স্পেস দিয়ে রিপ্লেস করতে জাভাস্ক্রিপ্টের replace() মেথড ব্যবহার করুন।
উদাহরণ
নিচের কোডটি রান করে দেখুন কিভাবে replace() মেথড দিয়ে নিউলাইনগুলো স্পেসে পরিবর্তন করা যায়:
<!DOCTYPE html> <html> <body> <p>শব্দগুলো:</p> <script> var words = "a\nb\nc\nd\ne\nf"; words = words.replace(/\n/g, " "); document.write(words); </script> </body> </html>