## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Jun 19 2021 12:36
@texas2010 banned @therichaverma
• May 14 2020 22:39
• May 14 2020 22:38
@bjorno43 banned @real-action
• Feb 01 2020 00:27
@bjorno43 banned @Ndoua
• Jan 07 2020 03:11
@bjorno43 banned @doctor-sam
• Jun 20 2019 21:20
@bjorno43 banned @shenerd140
• May 10 2019 09:13
@bjorno43 banned @zhaokunhaoa
• Oct 12 2018 05:50
@bjorno43 banned @NACH74
• Sep 16 2018 12:21
@bjorno43 banned @yash-kedia
• Sep 16 2018 12:15
@bjorno43 banned @vnikifirov
aaqeebh1
@aaqeebh1
@krisb1220
I get how it iterates through it but don't understand how it's pushing the value to it
Kris Baillargeon
@krisb1220
What do you mean by pushing the value to it?
Pushing the value to a?
As in, how does the variable a end up equaling the result?
aaqeebh1
@aaqeebh1
Yes exactly that
How does variable a end up equalling the result
Kris Baillargeon
@krisb1220
Okay, hold on I'll break the code up for u so it's easier to understand
and hopefully I'll teach ya some ways to figure stuff like this out in the future :) Give me one second
aaqeebh1
@aaqeebh1
aaqeebh1
@aaqeebh1
@krisb1220 any luck?
Kris Baillargeon
@krisb1220
function smallestCommons(arr) {
let max = Math.max(arr[0], arr[1]);
let min = Math.min(arr[0], arr[1]);
let range = [];

for (let i = min; i <= max; i++){
range.push(i);
}

console.log(range is ${range}); let a = range[0]; console.log(a starts as${a})

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

let b = range[i];
console.log(In loop ${i} b=${b})

let c = a;

while ( a && b){
if (a > b){
a %= b;
console.log(In loop ${i} while loop, a is changed to${a})

}else{
b = b % a;
console.log(In loop ${i} while loop, b is changed to${b})

}
}
console.log(a=${c} *${range[i]} / ${a}+${b})
a = c * range[i] / (a+b);

}
return a
}
// this ^^^^^ confuses me big time!!!!!!!!!

smallestCommons([1,3]);
Run that code. Let me know if it clears things up :)
If it doesn't let me know. I'll see if I can break it down further :)
Don't hesitate to let me know if you're still confused. It's honestly super confusing LOL
Kris Baillargeon
@krisb1220
Tbh, I wouldn't worry if you don't get that
It's a bunch of complicated math shit you're really never gonna use LOL
aaqeebh1
@aaqeebh1
Wow thanks I will give this a go first chance I get 2mrw 4am here time for bed!!!! LOL appreciate the help I will give you feedback tomorrow/ today aahhhh I'm fried LOL
Kris Baillargeon
@krisb1220
I feel ya dude. Know your limits! I get to a point where I tell myself "you're useless".. Cause I am LOL
If you're tired, you're not thinking right. Shit becomes 1000x harder
aaqeebh1
@aaqeebh1
I know right need sleep peace out dude 👍
aaqeebh1
@aaqeebh1
@krisb1220 thank you sir
helped me understand this alot more
i would hope some day i understand JS like you do @krisb1220 :)
Kris Baillargeon
@krisb1220
@aaqeebh1 You got this bro :)
Honestly, it was super confusing to me too
The best way to do it is to visualize what's happening through the loop
You'll notice that I just console.log() the different operations so you can see what's happening under the hood
Tbh, I've never had to do hardcore math like that. You'll probably have to do something like that eventually, but it's not often.
aaqeebh1
@aaqeebh1
thanks for taking the time bro ;) i appreciate it alot
my maths was good once upon a time maybe this will bring it back out and it wont be as confusing anymore :)
Kris Baillargeon
@krisb1220
@aaqeebh1 I was horrible at math in school
Failed it consistently
You don't really need hardcore math. When you do, you'll figure it out. Unless you have an actual serious learning disability related to math, you'll get it :) Even then, if you're persistent enough you'll still get it! It just takes time.
aaqeebh1
@aaqeebh1
i will be persistent!!!!!!!!!!!!!!
vasurajan
@vasurajan
Hi Everyone... am new here
How are you ?
Mer7in
@Mer7in
Hi every body
how to use lodash in freecodecamp?
Idris Fagbemi
@stwins60
Hello
Chris Dalton
@Chris-Dalton

Good day campers. I am running into an error while building the quiz app in VueJS. Here is my error:

[Vue warn]: Property or method "answers" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <QuestionBox> at src/components/QuestionBox.vue
<App> at src/App.vue
<Root>

Here is my App.vue file:

<template>
<div id="app">
<b-container class="bv-example-row">
<b-row>
<b-col sm="6" offset="3">
<QuestionBox
v-if="questions.length"
:currentQuestion="questions[index]"
:next="next"
/>
</b-col>

</b-row>
</b-container>

</div>
</template>

<script>
import QuestionBox from './components/QuestionBox.vue'

export default {
name: 'App',
components: {
QuestionBox
},
data() {
return {
questions: [],
index: 0
}
},
methods: {
next(){
this.index++
}
},
computed: {
}
},
mounted: function(){

fetch('https://opentdb.com/api.php?amount=10&type=multiple',{

method: 'get'
})
.then((response) => {
return response.json();
})
.then((jsonData) => {
this.questions = jsonData.results

});
}
}
</script>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

...and here is my QuestionBox file:

<template>
<div class="question-box-container">
<b-jumbotron>
{{currentQuestion.question}}
</template>

<hr class="my-4">

</p>

<b-button variant="primary" href="#">Submit Button</b-button>
<b-button @click="next" href="#">
Next Question
</b-button>

</b-jumbotron>
</div>
</template>

<script>
export default {
props: {
currentQuestion: Object,
next: Function
}
}
</script>

Aside from the error my issue is my answers are not showing on the UI even though I am passing {{answer}} into my paragraph tag. I have read through the page at https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties but it is a bit greek to me as this is my first go with VueJS. Can someone help? Please excuse any markdown errors. I will try to clean them up to make this more reader friendly.

Chris Dalton
@Chris-Dalton
I am having challenges getting an input from an html form to go into a recursion function. Can someone help me understand where I am going wrong? https://codepen.io/manwithgills/pen/gOrpGKE?editors=1111
Joseph Mawa
@nibble0101
@Chris-Dalton It seems you have fixed the issue
Donnie
@Donnie-D

@Donnie-D

let sampleWord = "astronaut";
let pwRegex = /^\D(?=\w{5})(?=\w*\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);

how in the above code, the regex /^\D(?=\w{5})(?=\w*\d{2})/ is the correct answer according to the hint section? The challenge states that the characters have to be minimum 5 and can be more. But this regex sets the \w to exactly {5} ?

Mohan-Chaitanya
@Mohan-Chaitanya
Hi Everyone, I was in the intermediate Algorithms & Datastructures session now, as a beginner it's taking a lot more time than I expected, can someone advise is it ok if I start learning React too simultaneously? also any better approach in getting good at algorithms and DS ?? Thankyou in advance.
Donnie
@Donnie-D
Man this forum is getting quiter. Where does one turn to help now
ch3fff
@ch3fff
function r(r){var t=[84,82,82,89,78,55,83,45,55,45,54,75,57];return r[0].charCodeAt(0)===t[6]&&r[1].charCodeAt(0)===t[11]&&r[2].charCodeAt(0)===t[3]&&r[3].charCodeAt(0)===t[9]&&r[4].charCodeAt(0)===t[2]&&r[5].charCodeAt(0)===t[4]&&r[6].charCodeAt(0)===t[1]&&r[7].charCodeAt(0)===t[0]&&r[8].charCodeAt(0)===t[7]&&r[9].charCodeAt(0)===t[8]&&r[10].charCodeAt(0)===t[5]&&r[11].charCodeAt(0)===t[10]&&r[12].charCodeAt(0)===t[12]}
Having trouble with this. Can anyone help? I'm looking for a flag. Please show how you did it if you can
Oops I pasted that. I'm new, sorry
Suria Nalen