Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
VaseJS
@VaseJS
its late here so i’m headed off to bed. i am interested in how everything turns. post on codepen or something we can see and interact with as its easier to help you.
until next time.
Anthony Drane
@Antiaccess
cheers mate
Bjorn van de Peut
@bjorno43

but that depends on your skill level. but just search vanilla css carousel and you’ll get a bunch of results. but understand the negative UX side of having a carousel on your site. an image gallery would be a better experience for users. but thats another topic :P

The amount of but's in there..

Markus Kiili
@Masd925
@bjorno43 There is no but in an empty statement. A new Chinese proverb.
Bjorn van de Peut
@bjorno43
lol
Amal Shukla
@amal1994
Guys, need help
what's the best way to contain common html and render it
for e.g if we are using Tabs
and there is common static content that needs to be shown on both tabs
suggestions needed - how to do it in anguar4+.
I'm not thinking of creating a component for it since it's just static data
Muhammed Hafiz
@zifahm
how do i do this?
React: Use a Ternary Expression for Conditional Rendering
https://beta.freecodecamp.org/en/challenges/react/use-a-ternary-expression-for-conditional-rendering
ternary expression that implements the following logic: when the page first loads, render the submit button, buttonOne, to the page. Then, when a user enters their age and clicks the button, render a different button based on the age. If a user enters a number less than 18, render buttonThree. If a user enters a number greater than or equal to 18, render buttonTwo.
{        (document.readyState=="loading") ? buttonOne:
          (this.state.userAge>18)?buttonThree:buttonTwo
           }
zipquote
@zipquote
var button; if (document.readyState=="loading") { button = buttonOne; } else if(this.state.userAge>18) { button = buttonThree; } else { button = buttonTwo; }
Why ternary? It's confusing as hell. Save output in some variable. Then in render {variable}
Markus Kiili
@Masd925
@zipquote Ternaries tend to make code harder to read and understand. You are correct in that.
Muhammed Hafiz
@zifahm
@Masd925 @zipquote the challenge is use terenery expression ... i can not use if /else statement
zipquote
@zipquote
My bad.
Try (document.readyState=="loading") ? buttonOne : ((this.state.userAge>18) ? buttonThree : buttonTwo )
Muhammed Hafiz
@zifahm
nope doesn't render
zipquote
@zipquote
What's the error?
Javier Pons
@JavierPons
I want to check if inside a (array of numbers) there is any number repeated. Some comments to this code.

```
function firstDuplicate(a) {
let repite = [];
for (let i = 1; i<a.lenght; a++) {

if (a[i] === a[i]) {
   return  repite.push(i)   
    }
}

}

Marianissimus
@Marianissimus
a[i] === a[i] always should return true, as you compare one item to itself :) @JavierPons
Javier Pons
@JavierPons
:+1:
Muhammed Hafiz
@zifahm
@zipquote error is in unexpected token near buttonOne
zipquote
@zipquote
There will be some line number and token also mentioned I think then
Javier Pons
@JavierPons
@Marianissimus does this expression have sense. a[I] == a[I+1]?
Marianissimus
@Marianissimus
yup @JavierPons
Javier Pons
@JavierPons
@Marianissimus :+1:
Marianissimus
@Marianissimus
however, it's far from perfect... @JavierPons
Javier Pons
@JavierPons
function firstDuplicate(a) {
let repite = [];
for (let i = 1; i<a.lenght; i++) {

    if (a[i] === a[i+1]) {
        repite.push(i)   
        } else {
            return -1;
        }
    }

    for (let j = 1; j.repite.lenght; j++)
}
I found out some mistakes
Marianissimus
@Marianissimus
length
push a[i], not i
length again
aaa... so many
Javier Pons
@JavierPons
:worried:
Marianissimus
@Marianissimus
:)
it's ok, you're learning
we all are
what's with the second loop? it's not doing anything.
Javier Pons
@JavierPons
@Marianissimus not yet
@Marianissimus if repite has a new array with duplicates I won't to check it and print the first num
but it was half writen
:smile:
Javier Pons
@JavierPons

```
let repite = [];
function firstDuplicate(a) {

for (let i = 1; i<a.length; i++) {

if (a[i] === a[i+1]) {
    repite.push(a[i]);   
    } else {
        return -1;
    }
}

};

for (let j = 1; j<repite.length; j++) {

return repite[j][0];

};

any comment? sometimes is given a lot of -1
Marianissimus
@Marianissimus
ok, what are the requirements for this function? if you need to return the first duplicate, it might not work if the items are not in sequence inside the arrey
Javier Pons
@JavierPons
@Marianissimus mmm...
Marianissimus
@Marianissimus
so you either need a double loop (one inside the other), or another js method. try indexOf / lastIndexOf, or map, reduce, filter, something in this category
Javier Pons
@JavierPons
:+1: :smile:
Marianissimus
@Marianissimus
@JavierPons here's a present for you; try to use console.log every step you develop a function, to see what it actually does; here's a loop inside a loop visualization
function findloopduplicate(arr){
    for (var i=0; i<arr.length; i++){
        for (var j=0; j<arr.length; j++){
        console.log ("Arr[i] is: " + arr[i] + " Arr[j] is: " + arr[j]);
        }
    }
}
As you see, arr[i] will stay as the first item, while arr[j] will loop through the array;
Javier Pons
@JavierPons
@Marianissimus thanks!
CamperBot
@camperbot
javierpons sends brownie points to @marianissimus :sparkles: :thumbsup: :sparkles: