how to count repeated characters in a string javascript
let str = "sanjay";
let obj = {};
for(let i=0;i<str.length;i++){ let key = str[i]; if(obj[key]){ obj[key]++ }else{ obj[key] = 1 } }
console.log(obj)

seen from United States

seen from United States
seen from United States
seen from United Kingdom

seen from United States
seen from Italy
seen from China
seen from United States

seen from Malaysia

seen from United States

seen from United States
seen from United States
seen from China

seen from Canada

seen from United States

seen from Brunei
seen from China
seen from United States
seen from Singapore
seen from China
how to count repeated characters in a string javascript
let str = "sanjay";
let obj = {};
for(let i=0;i<str.length;i++){ let key = str[i]; if(obj[key]){ obj[key]++ }else{ obj[key] = 1 } }
console.log(obj)

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
لماذا يتم تضمين "use strict" في كود جافاسكربت؟
لفترة طويلة ، تطورت JavaScript دون مشاكل التوافق. تمت إضافة ميزات جديدة إلى اللغة بينما لم تتغير الوظائف القديمة. ولكن الجانب السلبي هو أن أي خطأ أو قرار غير كامل يؤدي إلى توقف بالكامل. كان هذا هو الحال حتى عام 2009 عندما ظهرت ECMAScript 5 (ES5). أضاف ميزات جديدة إلى اللغة وقام بتعديل بعض الميزات الموجودة. للحفاظ على عمل الكود القديم ، يتم إيقاف تشغيل معظم هذه التعديلات افتراضيًا. و تحتاج إلى تمكينها صراحةً بتوجيه خاص: "use strict".
فوائد "use strict"
إلتقاط الأخطاء الشائعة و الأخطاء الصامتة.
لا تسمح بالمتغيرات العامة Global Variables في حالة عدم وجود الكلمة المفتاحية var امام أي متغير فأنها تعتبر خطأ.
منع حذف الخصائص او Properties الغير قابلة للحذف
بالمختصر المفيد "use strict" تساعدك في كتابة كود جافاسكربت آمن و خال من الأخطاء.
We live in a society that is running on rules or the laws as we call them. They are important for the smooth functioning of the society. In the same way, some rules have been made for the developers to follow. They are called coding standards. Let’s find out their necessity and use.
We live in a society that is running on rules or the laws as we call them. They are important for the smooth functioning of the society. In the same way, some rules have been made for the developers to follow. They are called coding standards. Let’s find out their necessity and use.