third problem solution before watching const words = 'javascript is a programming language'; function sortWords(words){ return words.split(' ').sort((a,b) => a.length - b.length).join(' ') } console.log(sortWords(words));
const str = "java is a programming language"; function sortWord(data) { dataAsarray = data.split(" "); dataAsarray.sort(); return dataAsarray.join(" "); } console.log(sortWord(str)); OUTPUT: "a is java language programming" No need of length checking between a,b
Dada happy to inform you that i have solved the first problem in another way. const elements = [ 'hello', 'bangladesh', 'linkedin', 'hello', 'linkedin', 'laptop', ]; const listed = elements.reduce((prev, curr) => { prev[curr] = (prev[curr] || 0) + 1; return prev; }, {}); console.log(listed);
// 1st one in may be the shortest possible way(just for fun) ["🥭", "🥭", "🥭", "🍇", "🍎", "🍎"].reduce((a, e) => (a[e] = -~a[e], a), {}); // {🥭: 3, 🍇: 1, 🍎: 2} // ⚠It is not recommended to write such code for any purpose other than recreation, as it is not readable and appears clever.
vaia sorry keno bolchen. apni to thik e likhechilen. eta just ami amar view bolechi. jehetu apni nije ei jinish ta bujhen tahole use korle to problem nai.
thanks vaia
ভাই প্লেলিস্ট টা কনটিনিউ করার অনুরোধ রইলো❤
আপনার বোঝানোর ধরনটা খবই সুন্দর। ভিডিওটা অসাধারণ ছিল ধন্যবাদ ❤
Next dada❤❤
DSA niye course dile valo hoito..banglay valo kono tutorial paini
third problem solution before watching
const words = 'javascript is a programming language';
function sortWords(words){
return words.split(' ').sort((a,b) => a.length - b.length).join(' ')
}
console.log(sortWords(words));
Problem solving ar bikolpo nie...❤❤
const str = "java is a programming language";
function sortWord(data) {
dataAsarray = data.split(" ");
dataAsarray.sort();
return dataAsarray.join(" ");
}
console.log(sortWord(str));
OUTPUT: "a is java language programming"
No need of length checking between a,b
Bhiya JavaScript course ta sesh howar por Project deben plz🧡
Playlists ta continue korar onurodh roilo Sumit Vai
korbo vai
We are waiting 🤗
❤❤❤
vaiya this is my solution before watching yours
const numberArr = [1,1,1,0,2,0,3,4,5,6,3,3,2,4];
function countsDuplicates(arr){
const counts = {};
for(let i = 0; i < arr.length; i++){
if(counts[arr[i]]){
counts[arr[i]] = counts[arr[i]] + 1;
}else{
counts[arr[i]] = 0 + 1;
}
}
return counts;
}
const result = countsDuplicates(numberArr)
It's a request, please continue giving videos on problem solving...
We believe problem solving can help us to become a good developer.
❤❤❤❤❤ dada❤❤❤
Thank you brother for sharing a valuable thing that is very important for us.
Awesome ❤ problem solution
অসাধারণ ছিলো দাদা। next JavaScript Interview Questions Problems Solved ভিডিও গুলো continue করলে আমাদের জন্য অনেক ভালো হতো , শুভো কামণা রইলো দাদা।
// Problem 1 - Duplicate elements...
const fruits = [
"apple",
"orange",
"mango",
"apple",
"pineapple",
"orange",
"apple",
];
// logic...
const duplicateCounter = (data) => {
const result = {};
data.forEach((word) => {
result[word] == undefined
? (result[word] = 1)
: (result[word] = result[word] + 1);
});
return result;
};
console.log(duplicateCounter(fruits));
First problem using array reduce:
const emojis = ['🍔', '👍', '🍔', '🍀', '🍔', '👍', '👏', '🤎', '🍀'];
const res = emojis.reduce((acc, cur) => {
if(!acc[cur]){
acc[cur] = 0;
}
acc[cur]++;
return acc;
}, {});
console.log(res);
Very helpful content. Continue please
Love you brother and god bless you!
Vaiya Big O notaion niya akta video dile khob upokreto hotam
Redux course ta kobe asbe?
3-4 diner moddhe
Thanks a lot
Dada happy to inform you that i have solved the first problem in another way.
const elements = [
'hello',
'bangladesh',
'linkedin',
'hello',
'linkedin',
'laptop',
];
const listed = elements.reduce((prev, curr) => {
prev[curr] = (prev[curr] || 0) + 1;
return prev;
}, {});
console.log(listed);
let fruits = [1, 3, 1, 4, 6, 8, 8];
let obj = fruits.reduce((totalValue, item) => {
totalValue[item] ? totalValue[item]++ : (totalValue[item] = 1);
return totalValue;
}, {});
console.log(obj);
For first one
Impressive❤❤❤
Please bhai continue the js job interview question playlist ❤ your content is best as always.
One line solution jodi karo lage
const reverseWord = (str) => str.split("").reverse().join("").split(" ").reverse().join(" ");
Apnar Vs theme tar name ki bola jave vaiya?
Video description e lekha ache. Learn with Sumit theme - Official variant
Love ✨🖤
function sentenceSort(sentence) {
const wordArr = sentence.split(" ");
const wordsLength = wordArr.map((w) => (w = w.length));
const sortedArr = [];
const minLength = Math.min(...wordsLength);
const maxLength = Math.max(...wordsLength);
for (let i = minLength; i {
if (element.length == i) {
sortedArr.push(element);
}
});
}
return sortedArr.join(" ");
}
dynamic r bepar ta jana chilo na, ami o vabtam multiple way te object er value access kora jai keno. ekhon bujlam.
❤ 18 Dec, 2023
প্রথমটাতে (Duplicate Element") আমি ১০০% if else ব্যবহার করতাম অথচ আমার জানা লজিকেই এক লাইনের যে এটা সলভ করা যায় সেটা মনে হয় না মাথায় আসতো।
practice koren ashbe.
🔥❤️
❤
💖💖💖💖
🎉❤
For you many programmers coming to this sector will not be disappointed. Thank you so much sir. If we get such a course it would be better sir.❤❤❤❤❤❤
I am really happy vai
@@LearnwithSumit We are grateful to you sir
// 1st one in may be the shortest possible way(just for fun)
["🥭", "🥭", "🥭", "🍇", "🍎", "🍎"].reduce((a, e) => (a[e] = -~a[e], a), {});
// {🥭: 3, 🍇: 1, 🍎: 2}
// ⚠It is not recommended to write such code for any purpose other than recreation, as it is not readable and appears clever.
nice solution but writing in one line does not mean readable
@@LearnwithSumit Thank you dada. I totally agree with you.
@@LearnwithSumit I've updated my comment. I'm really sorry dada for the things I did wrong in the comment.
vaia sorry keno bolchen. apni to thik e likhechilen. eta just ami amar view bolechi. jehetu apni nije ei jinish ta bujhen tahole use korle to problem nai.
❤❤❤
❤️❤️❤️❤️❤️❤️❤️
❤️❤️❤️