Watch Cognizant React/Frontend Interview kzbin.info/www/bejne/o5jMk6lop72ce7c 📌 Join our Telegram Channel t.me/Reactjs_Interview Please don't judge and comments on my answers. This is just the interview experience and If you know the right answers please comment below which can also help others.
@jaiku36892 жыл бұрын
Cant wait
@anandkumar-vq2eo2 жыл бұрын
function sum(...arr){ const total = arr.reduce((acc,val)=>{ if(typeof val === 'number') return acc + val else if(typeof val === 'string') return acc+parseInt(val) else return acc }) return total } console.log(sum(1,2,3, null, '4'))
@rahulxdd2 жыл бұрын
This doesn't work if an array is passed right? Could you tell me what is the use of spread operator in this?
@anandkumar-vq2eo2 жыл бұрын
@@rahulxdd Yes, this will not work if you pass array As per the question they asked here, i wrote the code.
function sum2(...args){ let total = 0; for(let arg of args){ if(Array.isArray(arg)){ total += sum2(...arg) }else if(!isNaN(arg)){ total += Number(arg) } } return total }
@SANJEEVGUPTA-bx8xb2 жыл бұрын
Helpful
@aghasghazryan11924 ай бұрын
function sum(...argsArray) { let total = argsArray.reduce((sumNumber, curr) => { switch (typeof curr) { case "number": return (sumNumber += curr); case "string": const number = parseInt(curr.match(/\d+/)[0]); return (sumNumber += number); case "object": if (Array.isArray(curr)) { const sumOfElements = curr.reduce((sum, curr) => sum + curr, 0); return (sumNumber += sumOfElements); } else { return sumNumber; } default: return sumNumber; } }, 0); return total; }
@RAMKUMARR-dm5mb4 ай бұрын
HI Mate do u have interview in Visa in few days !!
@pujadas18 Жыл бұрын
Make more video about product based company interview
@DevAditya Жыл бұрын
Sure 😊
@kedarkulkarni1072 жыл бұрын
how to know such good companies job requirements & from which websites to apply ??
Is visa company can provide good salary package bro?
@DevAditya2 жыл бұрын
Yup bro
@kovendanragupathi76322 жыл бұрын
@@DevAditya ok
@akashbhadouria6727 Жыл бұрын
@@DevAditya how much?
@Thanveershah2 жыл бұрын
Is this really a VISA interview? If yes, what is the level? Because this question seems to be very beginner, intermediate level.
@DevAditya2 жыл бұрын
1-2 Year Exp.
@Thanveershah2 жыл бұрын
@@DevAditya Did you get hired?
@AnkitKumar-vq9qx2 жыл бұрын
bhai koi suggest kar do React Developer ka job kaise le as fresher
@DevAditya2 жыл бұрын
Use LinkedIn for referal
@magedibrahim14052 жыл бұрын
function sum() { // Time complexity O(n) // Space complexity O(n) let total = 0; for (const index in arguments) { let argument = arguments[index]; if (Array.isArray(argument)) { // Call it over and over again until we reach numbers, add them, and return them. total += sum(...argument); continue; } total += Number(argument || 0); } return total; } console.log(sum(1, 2, 3, "4", NaN, null, undefined, [5, 6, 7, [[[[[8]], 9, 10]]]])); // 55
@saikumarkandikonda4312 жыл бұрын
let total = 0; const sum = (...numbers) => { numbers.map((number) => { // console.log("type of number is", typeof (number)) // console.log("is not a number ", isNaN(number)) if (isNaN(number) || typeof (number) === "object") { // console.log("ignore this"); return undefined; } else { total += parseInt(number); return parseInt(total); } }) return total; } console.log(sum(1, 2, 3, null, undefined, "4", [3, 2, 3]))
@programmingpictures44202 жыл бұрын
itni gandi english bolty hy ye angrez. Lahula wala quata😂😂
@sterinsaji32402 жыл бұрын
can you show the resume that got you selected for the interview
@DevAditya2 жыл бұрын
Sure, will make a video on it
@codeengineer102 жыл бұрын
@@DevAditya please make that video soon
@DevAditya2 жыл бұрын
@@codeengineer10 I have uploaded it on my topmate profile - topmate.io/roshan