venus
venus
RReactiflux
Created by venus on 12/14/2022 in #help-js
venus – 18-08 Dec 14
you're right, good point -> value !== 0 ? 1 : 0
16 replies
RReactiflux
Created by venus on 12/14/2022 in #help-js
venus – 18-08 Dec 14
or Number(value > 0)
16 replies
RReactiflux
Created by venus on 12/14/2022 in #help-js
venus – 18-08 Dec 14
so this should be the correct way to write it, right? const v3 = value > 0 ? 1 : 0;
16 replies
RReactiflux
Created by venus on 12/14/2022 in #help-js
venus – 18-08 Dec 14
good to know, thanks 🙂
16 replies
RReactiflux
Created by venus on 12/14/2022 in #help-js
venus – 18-08 Dec 14
they are in this case, input will be always a number I just wanted to demonstrate two variants that I thought of
16 replies
RReactiflux
Created by venus on 10/9/2022 in #help-js
✅ – venus – 12-02 Oct 9
Beautiful! Thank you
8 replies
RReactiflux
Created by venus on 10/9/2022 in #help-js
✅ – venus – 12-02 Oct 9
Looks good to me, thanks. But when I add some string after desc or asc it will still return true value:
console.log({ matched: Boolean(/\w+:(desc|asc)/.test("firstName:desca")) });
console.log({ matched: Boolean(/\w+:(desc|asc)/.test("firstName:desca")) });
8 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
Oh nvm, now I can understand
39 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
How is this meant?
39 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
const initialState = [
{ id: 'zero' },
{ id: 'one' }, // Previous item
{ id: 'two' }, // Existing array
{ id: 'three' }, // Existing array
{ id: 'four' }, // Existing array
{ id: 'five' }, // Next item
{ id: 'six' },
];

const selectedState = [
{ id: 'three' },
{ id: 'four' },
{ id: 'two' },
];
const initialState = [
{ id: 'zero' },
{ id: 'one' }, // Previous item
{ id: 'two' }, // Existing array
{ id: 'three' }, // Existing array
{ id: 'four' }, // Existing array
{ id: 'five' }, // Next item
{ id: 'six' },
];

const selectedState = [
{ id: 'three' },
{ id: 'four' },
{ id: 'two' },
];
39 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
Cuz it won't be in order as I thought
39 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
Oh, there might be a problem. I realized.
39 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
do you have it same?
39 replies
RReactiflux
Created by venus on 8/22/2022 in #help-js
✅ – venus – 09-58 Aug 22
I did edit this const firstItem = selectedArr[0];
39 replies