Why do you even want to use React , Better is to develop yours like I have developed my own UI library MIST JS additionaly you can use Css with html and js for best gui
There is another way // There is a question in which you have to find out the greatest string by creating a function find_Largest_String. If there are mulitple largest strings , it will encounter the very first one. let str = "My name is Owais Nadeem "; function find_Largest_String(a) { if (a.trim() === 0) { let empty = "The string is empty !!!"; return empty; } else { let words = a.split(" "); largest_str = words[0]; for (let i = 0; i < words.length; i++) { if (words[i].length > largest_str.length) { largest_str = words[i]; } } return largest_str; } } let result = find_Largest_String(str); console.log(result); Respect & Love from Pakistan
Amazing start 👍 Here is one more short way for it, i did this same question in one of the match in condingame with Java const str = "ThapaTechnical is the best" var words = str.split(' ') var lengths = words.map((word)=>word.length) console.log(words[lengths.indexOf(Math.max(...lengths))]); //Words list -> // console.log(words); // Index of max length word -> console.log(lengths.indexOf(Math.max(...lengths))); // length of words -> console.log(...lengths);
There is the oneline function to get the largest word from a sentence const getLargestWord = (str) => str.split(" ").reduce((ans, cur) => ans.length > cur.length ? ans : cur);
Pure Logic Method: function stringComparison (str) { if(str.trim().length === 0){ return false } const words = str.split(" ") let wordLength = 0; let index = 0 for(i=0; i wordLength) { wordLength = words[i].length index = i } } return words[index] }
function fingLongestword(str) { let arr = str.split(" ") let max = arr[0] for (let i = 0; i < arr.length; i++) { if (max.length < arr[i].length) { max = arr[i] } } return max } console.log(fingLongestword("my name is aryan negi i am from uttarakhand"));
function findLongestWord(str){ let strArr = str.split(" ") let longestWord = ''; for(let char of strArr){ if(longestWord.length < char.length){ longestWord = char } } return longestWord } let str = "JavaScript is a powerful and flexible language that opens up a lot of possibilities in web development" console.log(findLongestWord(str))
If a string has multiple long words of same length then : const str = "The quick brown fox jumps over the lazy dog jumps"; const longestnumber = (str) => { if (str.trim().length === 0) return false; let words = str.split(' '); words.sort((a, b) => b.length - a.length); let longestLength = words[0].length; // Filter words with the same length as the longest word let longestWords = words.filter(word => word.length === longestLength); return longestWords; } console.log(longestnumber(str)); //Output: ['quick', 'brown', 'jumps', 'jumps']
very awsome sir too good thank you so much sir for giving us such a imapactful content at free of cost. thank you so much and your technique and content is very different from others. thank you once again🙏🙏
function str(arg) { let word = arg.split(" ") let store = '' for (let words of word) { if (words.length > store.length) { store = words } return store; } }
Bro I would say, k javascript k built in functions ko use na karo, and custom kaam karo, interview may aksar mana kartay hen builtin methods/functions use karnay ka. Like 1 of the interviewer asked k sort kar do array ko without sort method, or find any element without filter or find methods use custom code etc
First Answer: const handleLargestWorld = (e) => { str = e.split(" "); console.log(str, "str"); return str.sort((a, b) => b.length - a.length)[0]; }; console.log( handleLargestWorld( "Hi My name is Ahsan IQbal. I am a FrontEndDeveloper" ) );
sir I have use another approach to find longest word is it fine 🤗 const findLongestWord = (str)=>{ const arr = str.split(" ") let lenArr = [] if(str.length === 0) console.log(false) else { for(i=0; i{ return word.length === lengthOfWord }) console.log(result)} } findLongestWord("Thapa Technical is the worlds best teaching channel")
Another Way to solve :-> using for loop function longestWord(words) { var splitedWord = words.split(" "); console.log(splitedWord) let firstin = splitedWord[0]; for (let i = 0; i < splitedWord.length; i++) { if (words == "") console.log("false"); else if (splitedWord[i].length > firstin.length) { console.log(splitedWord[i]); } } } longestWord("return the first one encountered.");
Bhai apki already JS pe bht video hai, New b sekhyen like Nextjs and prisma etc, frame work k sath sekhayen JS ko. Baki i know ye series b apka best hone ja raha h❤😅
my code const str = prompt("Enter the string ").trim(); const findLargestWord = () => { let words = str.split(" "); if (str.length === 0) return false; let wordLength = 0; let word = ""; for (let index = 0; index < words.length; index++) { if (words[index].length > wordLength) { wordLength = words[index].length; word = words[index]; } } return word; }; findLargestWord(str);
// Method 1 {Time Complexity - O(n)}. Easy to understand and implement function findLongestWord(str) { str = str.trim(); let words_arr = str.split(' ') let longestWord = words_arr[0]; for (i in words_arr) { if (longestWord.length { let words = str.split(' ') words.sort((a,b) => b.length-a.length) return words[0] } let str = "My name is Himanshu Oli" console.log(findLongestWord(str))
Guy's, if you love the series plz LIKE SHARE & SUBSCRIBE ❤
Also, if you have any coding challenges plz comment, and I will try to make a video on it 😊
Bro I hope its very usefull for us specially this 100 days chalLenge so can you make a PHP , PYTHON 100 DAYS CHALLENGES PLZ☺☺
🙂👍
From which platform you selected the questions? Please share the link ? @ThapaTechnical
If there are multiple longest words return the first one encountered??
production ma front end ka secret keys kha pa rakhtay ha
Vote For REACT Course ❤❤❤❤
React❤
❤
Yes bhaiya please ek react. Js ka course lounch ki kiya na
@@marketingvlogs5529 already uploaded h playlist check kro
Why do you even want to use React , Better is to develop yours like I have developed my own UI library MIST JS additionaly you can use Css with html and js for best gui
waah bhai, ye to bahut acchi baat hai, abhi recently aapke javascript ka sare course complete kar liya abi logics v build ho gya,😊😊😊
function givebigstr(str) {
let val=0
let string=""
let arr=str.split(" ");
arr.map((e)=>{
if(e.length>val){
string=e
val=e.length
}
})
return string
}
Bhi loop se karna asan honga na
@@tsdonalds1668 ye loop hi to he array k liye
!!!
There is another way
// There is a question in which you have to find out the greatest string by creating a function find_Largest_String. If there are mulitple largest strings , it will encounter the very first one.
let str = "My name is Owais Nadeem ";
function find_Largest_String(a) {
if (a.trim() === 0) {
let empty = "The string is empty !!!";
return empty;
} else {
let words = a.split(" ");
largest_str = words[0];
for (let i = 0; i < words.length; i++) {
if (words[i].length > largest_str.length) {
largest_str = words[i];
}
}
return largest_str;
}
}
let result = find_Largest_String(str);
console.log(result);
Respect & Love from Pakistan
Bubble sort
I have done with method
Even you can do it by reduce method
yes that good but array has its own loops like map .. for each ..for of..... these methods are easy as u don't need to write For loop...
Like or share kardo sab log ... thapa sir bhot mehnat se video banate h ❤❤
Amazing start 👍
Here is one more short way for it, i did this same question in one of the match in condingame with Java
const str = "ThapaTechnical is the best"
var words = str.split(' ')
var lengths = words.map((word)=>word.length)
console.log(words[lengths.indexOf(Math.max(...lengths))]);
//Words list -> // console.log(words);
// Index of max length word -> console.log(lengths.indexOf(Math.max(...lengths)));
// length of words -> console.log(...lengths);
There is the oneline function to get the largest word from a sentence
const getLargestWord = (str) => str.split(" ").reduce((ans, cur) => ans.length > cur.length ? ans : cur);
Pure Logic Method:
function stringComparison (str) {
if(str.trim().length === 0){
return false
}
const words = str.split(" ")
let wordLength = 0;
let index = 0
for(i=0; i wordLength) {
wordLength = words[i].length
index = i
}
}
return words[index]
}
Sir thank you somuch ..apne programming sikhna bahot easy bna Diya or ab ye 100 days wali series se bahot confidence milega..
Most awaited series. Please cover 3 to 5 questions everyday
Thankyou so much sir ye interview questions lane ke liye 😀✨ bahut kuch sikhne ko milta h Apka tutorial se
function fingLongestword(str) {
let arr = str.split(" ")
let max = arr[0]
for (let i = 0; i < arr.length; i++) {
if (max.length < arr[i].length) {
max = arr[i]
}
}
return max
}
console.log(fingLongestword("my name is aryan negi i am from uttarakhand"));
Thanks for starting this , mjhy es course ki bht zaroorat thi to build logic in programming
there is no such series on the internet....this series will help me a lot❣
Great Sir! I'll continue This playlist InshAllah
best channel for learn coding thanks bro....
Vote for DSA in javascript 🎉
Thank u sir is tarah ki js ki video ki bahut need thi
Thanks🙏
Watching and learning from Spain 😊. Thanks Thapa Bro.
Amazing teacher
Yes sir rokiye ga mt sir 100 days se pehle logic tagda wala build kriye gaa
Super excited for 100 days 😃
Salute sir ji ❤
Your energy and enthusiasm are contagious. Love it!
Best Class Thanks A Lots 🎉
Super Excited for this.
Day01 Completed sucessfully🍀🍀
bilkul bro start journey
function LongestWord(inputString) {
const list = inputString.split(" ");
let longestString = "";
for (str of list) {
if (str.length > longestString.length) {
longestString = str;
}
}
if (longestString == "") {
return false;
}
return longestString;
}
Day-1 Question was amazing meet you soon on Day-2
Really very excited
awsome series thank you sir
Excellent thanks sir ❤❤❤❤
I am super excite for js course ❤❤❤
Day - 01 Present Sir
Thanks a lot and waiting for React Series
Best js series very indepth knowledge
Wow! awesome challenege, thanks to start...
i am very exciting sir, your really great sir🔎🔎
function findLongestWord(str){
let strArr = str.split(" ")
let longestWord = '';
for(let char of strArr){
if(longestWord.length < char.length){
longestWord = char
}
}
return longestWord
}
let str = "JavaScript is a powerful and flexible language that opens up a lot of possibilities in web development"
console.log(findLongestWord(str))
As always I love your videos. It really helps me.
👌👌👌
Thanks good effort
thank you sir🤩🤩🤩
If a string has multiple long words of same length then :
const str = "The quick brown fox jumps over the lazy dog jumps";
const longestnumber = (str) => {
if (str.trim().length === 0)
return false;
let words = str.split(' ');
words.sort((a, b) => b.length - a.length);
let longestLength = words[0].length;
// Filter words with the same length as the longest word
let longestWords = words.filter(word => word.length === longestLength);
return longestWords;
}
console.log(longestnumber(str));
//Output:
['quick', 'brown', 'jumps', 'jumps']
Absolutely amazing👍
very awsome sir too good thank you so much sir for giving us such a imapactful content at free of cost. thank you so much and your technique and content is very different from others. thank you once again🙏🙏
🙏🙏🙏🙏
function str(arg) {
let word = arg.split(" ")
let store = ''
for (let words of word) {
if (words.length > store.length) {
store = words
}
return store;
}
}
Well done ✅
You've start a series which will help us alot ❤
Thank sir is series ko lane ke liye
It is very helpful in js practice
Most awaited series.. Day #1 attendee 👩💻 Do more likes for his remarkable efforts....
Really thanks for the series bhai and I am super excited for the next 100days...#worldsbestJSseries
Yes sir very excited 🎉
Are you prepration of frontend ?
thanks for this series .
Bro I would say, k javascript k built in functions ko use na karo, and custom kaam karo, interview may aksar mana kartay hen builtin methods/functions use karnay ka.
Like 1 of the interviewer asked k sort kar do array ko without sort method, or find any element without filter or find methods use custom code etc
Wah sir great
Hi bro. Each and every video you are making its very useful and interesting..keep doing more videos. It is very helpful to all bro.
const findlongestWord = (string) => {
if(string.trim().length === 0){
return false;
}
let words = string.split(" ");
words = words.sort((a,b) => a.length - b.length);
let longestWord = words[words.length - 1];
return longestWord;
}
console.log(findlongestWord("Hi I Am Devraj Prasad"));
Just love it brother❤️
very nice video . continue the series.
great series sir keep it up
First Answer:
const handleLargestWorld = (e) => {
str = e.split(" ");
console.log(str, "str");
return str.sort((a, b) => b.length - a.length)[0];
};
console.log(
handleLargestWorld(
"Hi My name is Ahsan IQbal. I am a FrontEndDeveloper"
)
);
function longestWord(str){
let splirStr=str.split(' ')
let longestWord=splirStr[0];
for(let i=0;ilongestWord.length){
longestWord=splirStr[i]
}
}
return longestWord;
}
Why is it always giving first number of array instead of longest number
@@abumursad Only for assuming the largest number for the first element of the array
Making your eCommerce website project right now 😊
watching your video from australia
lot of love thapa daju
When we convert string into array . Then we can also use forEach for making this question
Awesome ♥️♥️
Love from Bangladesh Thapa Bro
Awesome 🎉🎉🎉🎉
JavaScript Challenge 100/1 day is Completed 👍
Thanks 🙏 sir
Supper Tutorial ❤
You always awaresome....
sir I have use another approach to find longest word is it fine 🤗
const findLongestWord = (str)=>{
const arr = str.split(" ")
let lenArr = []
if(str.length === 0) console.log(false)
else {
for(i=0; i{
return word.length === lengthOfWord
})
console.log(result)}
}
findLongestWord("Thapa Technical is the worlds best teaching channel")
Super experience 🎉
Love you brother ❤❤
Thank you for your help. ......❤❤❤❤
Thank you so much thappa sir you are the best :)
Nice bro awesome for great video ❤❤❤❤
Sir Reactjs pr update playlist bano plz sir .🙏
Another Way to solve :-> using for loop
function longestWord(words) {
var splitedWord = words.split(" ");
console.log(splitedWord)
let firstin = splitedWord[0];
for (let i = 0; i < splitedWord.length; i++) {
if (words == "") console.log("false");
else if (splitedWord[i].length > firstin.length) {
console.log(splitedWord[i]);
}
}
}
longestWord("return the first one encountered.");
Why is it always giving first number of array instead of longest number
No words❤
Bhai apki already JS pe bht video hai, New b sekhyen like Nextjs and prisma etc, frame work k sath sekhayen JS ko.
Baki i know ye series b apka best hone ja raha h❤😅
Please write the question in the description. So that, we can copy in our file and start to solve it.
Awesome👏❤
Nice brother .
next series React ❤❤ updated version 👌👌
Nice sir
my code
const str = prompt("Enter the string ").trim();
const findLargestWord = () => {
let words = str.split(" ");
if (str.length === 0) return false;
let wordLength = 0;
let word = "";
for (let index = 0; index < words.length; index++) {
if (words[index].length > wordLength) {
wordLength = words[index].length;
word = words[index];
}
}
return word;
};
findLargestWord(str);
// Method 1 {Time Complexity - O(n)}. Easy to understand and implement
function findLongestWord(str) {
str = str.trim();
let words_arr = str.split(' ')
let longestWord = words_arr[0];
for (i in words_arr) {
if (longestWord.length {
let words = str.split(' ')
words.sort((a,b) => b.length-a.length)
return words[0]
}
let str = "My name is Himanshu Oli"
console.log(findLongestWord(str))
Complete react course with projects
Great
100 DAYS CHALENGE OF JAVASCRIPT ❤❤❤❤❤❤❤❤❤❤
me bhi js ke questions bna rha hu aapki suggestion man kr fir chote projects banane ka plan hai
Bhai apse reauest hai react js and express js complete one video le ayye ....aek video bana deejye roadmap kiske baad kiya seekhen
Good going, Btw which theme you are using.....?
Don't Stop this
Bhaiya aa vaise for loop bhi use kar sakte ho array manupulation ke liya 😂😂😂