DEV Community

Discussion on: Welcome Thread - v15

Collapse
 
luisandrestobon profile image
luisandrestobon

Hello, my name is Luis. I'm from Colombia. I'm an electronic engineer but I love to code. I'm not a pro in this, but I try my best to learn every day. I'm learning Angular 6 right now. My favorite non-coding hobby is perhaps to travel. That's it, thanks a lot.

Collapse
 
joredjs profile image
Joredjs

Good!! I´m from Colombia too !!

Collapse
 
benjcal profile image
Benjamin Calderon

Saludos Luis!
I'm a developer but I'm in love with embedded dev, embedded Linux, microcontrollers and such (ST32 HAL is beautiful in my opinion!)

Anyways, welcome!

Collapse
 
trocha11 profile image
nilson

Hola yo soy NiluX o Linux

Collapse
 
henrygmoshugi profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
henrygmoshugi

Oh yes embedded is most in use this days and grow like multiply as everyone now know streaming even small companies and organisations going for streaming

Collapse
 
zarulyakuza profile image
zarulyakuza

:) nice

Collapse
 
Sloan, the sloth mascot
Comment deleted
 
chiangs profile image
Stephen Chiang

here's one way:

const myFunc = (number) => 
  number === 1 ? 0 : number === 0 ? 1 : null;

myFunc(1)
// 0

myFunc(0)
// 1

myFunc(2)
// null
Collapse
 
polisettymanoj profile image
Manoj Kumar

Hi Sir, Can You answer this question??
Write a vanilla javascript program that returns 0 when input is 1 and 1 when input is 0. Do not use if, for, while, switch, do statements. Write as many implementation as you can think of (minimum 4 ways).

Collapse
 
luisandrestobon profile image
luisandrestobon

Hello. Well, I think this is it:

f1 = (input) => { return (1+input)%2 };

f1(0); // 1
f1(1); // 0

f2 = (input) => { return (1-input)%2 };

f2(0); // 1
f2(1); // 0

f3 = (input) => { return ~input&1 };

f3(0); // 1
f3(1); // 0

f4 = (input) => { return +!input };

f4(0); // 1
f4(1); // 0

I'm waiting for your comments about it. Thank you.

Collapse
 
devwanjihia profile image
Samson Wanjihia

return [1, 0][input]

Collapse
 
kuil09 profile image
Hwang, Geon Gu

Nice to meet you Luis.

Collapse
 
manzanit0 profile image
Javier Garcia

Nice! :) What kind of projects do you work in as an Electronic Engineer?

Collapse
 
luisandrestobon profile image
luisandrestobon

Well, nothing exciting. I worked for a medical company for about 7 years, but my job was to install, repair and do maintenance to medical devices. Right now my job is in the management area... kind of boring sometimes, but a job is a job ;)

Collapse
 
uniquely_deji profile image
Fareedah Amzah

Hello Luis. Good to have you here

Collapse
 
jpabloobando profile image
Jose Pablo Obando Gonzalez

Hello !!