JavaScript Interview Questions |Machine Round|Arrange the string in Ascending Order

preview_player
Показать описание
JavaScript Interview Question for Freshers

Watch the complete video till the end to understand it completely

Checkout my Instagram account to find the latest notes on React, Angular and Javascript.

Instagram handler Name: @nishasingla05

Watch complete video to understand in depth.

Support my channel by liking and sharing my videos so that I can reach to wider audience. Please share it in your network 🙏

►Checkout JavaScript Interview Playlist

►Checkout ES6 Playlist

►Click here to Subscribe the channel:

►Angular Complete Course:

►All important shorts videos:

Connect with Me On Social Media

#nishasingla #javascript #interview
Рекомендации по теме
Комментарии
Автор

const str = "react is a library";

function test(str) {
let input = str.split(" ");

for(let i=0;i<input.length-1;i++) {
for(let j=i+1;j<input.length;j++) {
if(input[i].length > input[j].length) {
[input[i], input[j]] = [input[j], input[i]];
}
}
}
return input;
}
console.log(test(str));

ajaykumar-howz
Автор

let str = 'react is a library';

function reverseString(str) {
str = str.split(' ')
let map = {};
for(let i=0;i<str.length;i++) {
map[str[i]] = str[i].length;
}
let output = str.sort((a, b) => map[a] - map[b]);
return output.join(' ');
}

ajaykumar-howz
Автор

Thank you for this video, can you please make video on how to get the least positive number in a easy way(for example1: Given A = [1, 2, 3], the function should return 4. example 2: Given A = [−1, −3], the function should return 1)

adarshapc
Автор

SIMPLE SOLUTION **

const str = "react is a library"

const data = str.split(" ")

console.log(data.sort((a, b)=>{
return a.length - b.length
}))

rohankadam
Автор

please make video on coding part of react

satyaranjanbehera
Автор

Hello mam can you please make a video of like we have (abcab)so we have to find not repeating character like in this case c is not repeating so how we can do this ?

ritikparida