30th
Oct 2018
Claudio Restifo
@Marmiz
Oct 30 2018 03:24

If anyone wants to do some extra practice:

Convert a number to a string, the contents of which depend on the number's factors.

- If the number has 3 as a factor, output 'Pling'.
- If the number has 5 as a factor, output 'Plang'.
- If the number has 7 as a factor, output 'Plong'.
- If the number does not have 3, 5, or 7 as a factor,
just pass the number's digits straight through.

## Examples

- 28's factors are 1, 2, 4, **7**, 14, 28.
- In raindrop-speak, this would be a simple "Plong".
- 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30.
- In raindrop-speak, this would be a "PlingPlang".
- 34 has four factors: 1, 2, 17, and 34.
- In raindrop-speak, this would be "34".

Bonus: Try looping only once... or not at all!

Christopher McCormack
@cmccormack
Oct 30 2018 03:29
oh fun
Tommy Bogdanovich
@Tommyisr
Oct 30 2018 03:29
3 if's and function that converts a number to string
Christopher McCormack
@cmccormack
Oct 30 2018 03:30
Claudio Restifo
@Marmiz
Oct 30 2018 03:37
@Tommyisr the number to string part is probably relevant only if you do it in a typed lang
char convert(n int) {...}

// or

func convert(n int) string {...}
in js just make sure retrurn a string
p.s. can copy pasta some test cases if you want to try it :)
Tommy Bogdanovich
@Tommyisr
Oct 30 2018 03:40
It's 5:40 am now, I'll try it later ;)

@kaikaidaren
Oct 30 2018 03:56
..
it's 11:57 am now
Karma Drukpa
@coderkarma
Oct 30 2018 04:43
hello
need help
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
// make a copy of existing arr
let newArr = arr2.slice();
newArr.splice(1, 0, ...arr1 );
return newArr;
}frankenSplice([1, 2, 3], [4, 5, 6], 1)
Christopher McCormack
@cmccormack
Oct 30 2018 04:56
@coderkarma why are you splicing the number 1 in?
may need to review that again
Karma Drukpa
@coderkarma
Oct 30 2018 05:00
Yes I am reviewing that. So our task here is to keep the number first and last of second array right and need to insert the first array
@cmccormack
Karma Drukpa
@coderkarma
Oct 30 2018 05:13
okay, I get it, I have to loop through array1 and splice it
Manish Giri
@Manish-Giri
Oct 30 2018 05:53
@coderkarma you can also do it without using splice at all
without using a loop too
kinopotato
@kinopotato
Oct 30 2018 08:24
is it normal to feel like you'll never learn how to code? I've been studying JS non stop for a month today, I feel like all I can do is write let a = b and I even forget the equal sign from time to time xD
@ezioda004
Oct 30 2018 08:28
I'd say its normal. Retaining stuff takes a lot of practice.
kinopotato
@kinopotato
Oct 30 2018 08:29
It makes me want to take a nap all the time. haha. well back to FCC then, thanks for the insight, at least I know I'm doing alright.
@ezioda004
Oct 30 2018 08:31
:thumbsup:
@diomed
Oct 30 2018 08:42
I already found a problem - your code seems to work fine.
Manish Giri
@Manish-Giri
Oct 30 2018 09:23
Anand Potukuchi
@anandpotukchi
Oct 30 2018 09:30
what id the difference between babel-rpeset-stage-
ANYONE
@diomed
Oct 30 2018 10:26
@Manish-Giri oh now you remembered. where were you yesterday :smirk_cat:
Nicolas Ramirez
@kamatheuska
Oct 30 2018 10:35
hey people, morgen! my PR got rejected :cry:
Didn't pass Travis Integration. Found this error:
Error:
The article at: /home/travis/build/freeCodeCamp/freeCodeCamp/guide/spanish/blockchain/features/index.md is missing frontmatter.
Nicolas Ramirez
@kamatheuska
Oct 30 2018 10:40
@ezioda004
pumpkinT
@pumpkinT
Oct 30 2018 11:04
Hi guys
I need help with adding a subpage - for a website
Im using bootstrap
Nicolas Ramirez
@kamatheuska
Oct 30 2018 11:08
@pumpkinT can you post some code?
@diomed
Oct 30 2018 11:09
sup? page
Nicolas Ramirez
@kamatheuska
Oct 30 2018 11:10
@diomed hey kitty katty, help me with my PR
pleeease
@diomed
Oct 30 2018 11:15
@kamatheuska which pr?
Nicolas Ramirez
@kamatheuska
Oct 30 2018 11:16
look up!
Travis hates me, it seems
@diomed
Oct 30 2018 11:19
i disunderstand that >.<
Nicolas Ramirez
@kamatheuska
Oct 30 2018 11:22
come oooon
tundeiness
@tundeiness
Oct 30 2018 12:01
hi guys I need help with styling the image in this grid container. it keeps jutting out of the main grid container whenever I attempt resizing to see how responsive it will be. Here is the link to the project: https://codepen.io/highness/pen/VdGxwm?editors=1100
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:24
@kamatheuska what do upyou need
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:29
@Nirajn2311 I did a Pull request to FreeCodeCamp but it got rejected :(
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:30
Got closed or travis failed
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:31
travis failed
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:31
When did you open the pr
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:31
yesterday
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:32
Whats the pr number
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:33
@tundeiness you have to give your <img> element a height: 100%; width: auto; so it stays inside its container. Now the container div .top is the one going out .grid
@Nirajn2311
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:34
Give me a minute
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:34
thanks
tundeiness
@tundeiness
Oct 30 2018 12:41
@kamatheuska okay thanks...let me try that out
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:44
@kamatheuska Your PR is all right
If you look at Travis log you'll see it was an error in some other file which was identified and fixed quickly
But by the time all other PRs till the fix have failed
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:45
@tundeiness Also, the width: 60% seems to be the one responsible for the error
@Nirajn2311 oh
and what can I do?
tundeiness
@tundeiness
Oct 30 2018 12:46
@kamatheuska yeah I checked it out...it's still not working
Niraj Nandish
@Nirajn2311
Oct 30 2018 12:46
Just wait, i restarted the build
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:47
if you want your .grid centered, you can do a grid on the body, or make a wrapper div, that has a display: grid and a 3 column layout. That is what I would do
@tundeiness
cool!
tundeiness
@tundeiness
Oct 30 2018 12:47
@kamatheuska what should I do?
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:48
or
@tundeiness you could use display:flex
I would use the disply:grid option if I were you @tundeiness
tundeiness
@tundeiness
Oct 30 2018 12:51
@kamatheuska running away from flex for this task though :laughing: but it's not impossible to use display: flex within grid right? cause I have seen it done somewhere.
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:51
not a good idea, if you ask me
tundeiness
@tundeiness
Oct 30 2018 12:51
@kamatheuska well I am using display: grid ?
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:51
not possible in the same div
tundeiness
@tundeiness
Oct 30 2018 12:53
maybe you mean I should use display:grid for the img container right?
@kamatheuska
Nicolas Ramirez
@kamatheuska
Oct 30 2018 12:53
noo
image is fine
your problem is in the .grid
div
you have to figure out another way to make a centered div container, that means your div.grid
Nicolas Ramirez
@kamatheuska
Oct 30 2018 13:03
@tundeiness solved? :smile:
tundeiness
@tundeiness
Oct 30 2018 13:04
@kamatheuska not yet
Anand Potukuchi
@anandpotukchi
Oct 30 2018 13:10
anyone know
what the difference between the babel-preset-stage
0,1,2,3,4
et?
@cmccormack @ezioda004 ?
Niraj Nandish
@Nirajn2311
Oct 30 2018 13:12
@diomed any celebrations for national cat day
Aravindios
@Aravindios
Oct 30 2018 13:57
hi
how to write function and call inside the php
function for onchange
if there is any example pls share
Christopher McCormack
@cmccormack
Oct 30 2018 14:01
I believe it follows the tc39 process @anandpotukchi
Nicolas Ramirez
@kamatheuska
Oct 30 2018 14:03
@cmccormack Morning! Could you tell me why my PR was rejected? It seems that my commit is ok, but that Travis CI failed for some reason.
Christopher McCormack
@cmccormack
Oct 30 2018 14:08
@kamatheuska it wasn't rejected just failed the Travis CI testing. This is most likely do to a non release
Non related issue
Sorry on mobile
Nicolas Ramirez
@kamatheuska
Oct 30 2018 14:08
its ok :smile:
Christopher McCormack
@cmccormack
Oct 30 2018 14:08
I have restarted the testing
Nicolas Ramirez
@kamatheuska
Oct 30 2018 14:09
I can do more of those! way more. Just wanto be sure that is the right way to go
Niraj Nandish
@Nirajn2311
Oct 30 2018 14:09
@cmccormack I had restarted it like a while ago
There seem to be some error in challenge testing
@kamatheuska Your PR is fine but you'll have to wait for a month to get it reviewed and merged 😆😆
Nicolas Ramirez
@kamatheuska
Oct 30 2018 14:12
hahahah noooo
riptide
@Riptide-X
Oct 30 2018 14:44
hey guys i want to know the last error is what?
Niraj Nandish
@Nirajn2311
Oct 30 2018 14:45
What error are you talking about @Riptide-X ?
riptide
@Riptide-X
Oct 30 2018 14:48
o i get it means actually i'm trying to learn it first day Thx anyway @Nirajn2311
Nicolas Ramirez
@kamatheuska
Oct 30 2018 14:49
@Riptide-X what error x2?
Niraj Nandish
@Nirajn2311
Oct 30 2018 14:49
😕😕
riptide
@Riptide-X
Oct 30 2018 14:50
to chat with you guys i think its a challenge to my English (sad face)
riptide
@Riptide-X
Oct 30 2018 14:55
my level only CET6 0.0
Nicolas Ramirez
@kamatheuska
Oct 30 2018 14:57
@Riptide-X sure, no prob. English isn't my mother tongue either. What's up?
riptide
@Riptide-X
Oct 30 2018 15:01
ummm THX XD the error i 've fond and solve it @kamatheuska
Nicolas Ramirez
@kamatheuska
Oct 30 2018 15:02
sure buddy! :)
@diomed
Oct 30 2018 15:05
@Nirajn2311 I mean, wasn't that yesterday?
Niraj Nandish
@Nirajn2311
Oct 30 2018 15:08
@diomed Every day i get a chance to pet a cat is like a national cat day for me
@diomed
Oct 30 2018 15:09
you're my kind of person, human :cat:
Niraj Nandish
@Nirajn2311
Oct 30 2018 15:09
Hows vue going
@diomed
Oct 30 2018 15:10
going, going, gone!
may vue be with you
Nicolas Ramirez
@kamatheuska
Oct 30 2018 15:11
@diomed check my auth-me-plug
is just dope
@diomed
Oct 30 2018 15:12
@kamatheuska what is this for? authentification?
Nicolas Ramirez
@kamatheuska
Oct 30 2018 15:12
yep, for a lazy ass like me :D
components
@diomed
Oct 30 2018 15:13
I dont even know how to use this
@kamatheuska are u on discord?
Nicolas Ramirez
@kamatheuska
Oct 30 2018 15:16
yeah!
on the vue discord channel
Anand Potukuchi
@anandpotukchi
Oct 30 2018 16:48
fcc doesn't teach youa a lot of stuff
just realized
Jason Luboff
@JLuboff
Oct 30 2018 16:48
Sure it does
Niraj Nandish
@Nirajn2311
Oct 30 2018 16:49
@anandpotukchi Like what??
@ezioda004
Oct 30 2018 17:09
@anandpotukchi fCC is about web development and it teaches it very well. I'm sure the curriculum will expand at some point.
Jason Luboff
@JLuboff
Oct 30 2018 17:10
I mean... it did just expand not too long ago
Anand Potukuchi
@anandpotukchi
Oct 30 2018 17:10
You know like stuff on w config
*webpack
Had a lot of trouble with it
@JLuboff @ezioda004 @Nirajn2311
Just one of things
Yeah.. I'm not degrading FCC, m a great supporter…but stuff like that needs to be included
@ezioda004
Oct 30 2018 17:13
@JLuboff True, though I think the current curriculum needs to be polished. I've been encountering a lot of bugs in the coding interview section which arent reported yet, and its frustrating.
@anandpotukchi Stuff like webpack?
Jason Luboff
@JLuboff
Oct 30 2018 17:13
Why do you feel that it should be included? You don't have to have webpack
@ezioda004
Oct 30 2018 17:13
Thats a bad idea. Tool changes, today is webpack, tomorrow its parcel, yesterday it was grunt, gulp.
Anand Potukuchi
@anandpotukchi
Oct 30 2018 17:14
Point
Jason Luboff
@JLuboff
Oct 30 2018 17:14
@ezioda004 Oh I agree. I've only gone through a bit of it (ES6, React)
Anand Potukuchi
@anandpotukchi
Oct 30 2018 17:15
Maybe I'm just a beginner. So the struggle and frustration
@ezioda004
Oct 30 2018 17:15
@JLuboff I'm working on updating the React section, some of the info is outdated or there are better alternatives.
Jason Luboff
@JLuboff
Oct 30 2018 17:15
@ezioda004 :thumbsup: I actually found both sections (ES6 and React) to be... confusing at times
Anand Potukuchi
@anandpotukchi
Oct 30 2018 17:18
@JLuboff they are.
@ezioda004 16.6?
@ezioda004
Oct 30 2018 17:19
@JLuboff If you have suggestions, do let me know. We can certainly do something about making React more approachable to beginners.
@anandpotukchi Yes.
Anand Potukuchi
@anandpotukchi
Oct 30 2018 17:20
Jason Luboff
@JLuboff
Oct 30 2018 17:20
@ezioda004 I'd have to go back through the content...but if I remember any off hand I'll let you know
Anand Potukuchi
@anandpotukchi
Oct 30 2018 17:20
Though it might be outdated, has a ton of resources
@ezioda004
Oct 30 2018 17:21
@JLuboff Awesome, thanks.
Jason Luboff
@JLuboff
Oct 30 2018 17:23
@ezioda004 I do remember there is one React challenge that you need to map over an array and return list elements (<li> element </li>) but it doesn't pass testing
@ezioda004
Oct 30 2018 17:24
@JLuboff Ah yes, the one with <li class="text-warning"> </li>?
Jason Luboff
@JLuboff
Oct 30 2018 17:24
Sounds right
@ezioda004
Oct 30 2018 17:26
Yeah the regex for its solution is quite strict
Jason Luboff
@JLuboff
Oct 30 2018 17:27
It uses regex for testing?
@ezioda004
Oct 30 2018 17:37
Most of them do, cant find that challenge to check
Jason Luboff
@JLuboff
Oct 30 2018 17:43
@ezioda004
Oct 30 2018 17:46
@JLuboff Thanks, for some reason I remember it being a React challenge, anyway heres the test:
 testString: assert(makeList(result.failure).every((v, i) => v === <li class="text-warning">${result.failure[i]}</li> || v === <li class='text-warning'>${result.failure[i]}</li>), '<code>resultDisplayArray</code> is the desired output.');
So even <li class = "text-warning"> wouldnt pass.
Jason Luboff
@JLuboff
Oct 30 2018 17:49
Lame lol
Niraj Nandish
@Nirajn2311
Oct 30 2018 17:57
Isnt using regex for tests constricting the range of answers
@ezioda004
Oct 30 2018 18:03
A good regex can be quite flexible, in this case it's not using regex for this test case though I think its fine since its matching string, and they are matched by "value" so having it also match a different string could be confusing.
Kyle Holm
@thekholm80
Oct 30 2018 18:03
i agree
@ezioda004
Oct 30 2018 18:05

This test is useless:
testString: getUserInput => assert(getUserInput('index').match(/.*/g), 'Template strings were not used');

There are comments in the challenge which passes this test 🤦

Amit Patel
@AmitP88
Oct 30 2018 18:07
hey guys, I'm working on the calculator project in React and I'm struggling pretty bad when it comes to passing test#11 (handling decimals). Is this bad? :(
here's my project in a codesandbox (live) : https://codesandbox.io/live/v2WYzV
chat's enabled in there too
@ezioda004
Oct 30 2018 18:08
Are you not checking what values are being input?
Amit Patel
@AmitP88
Oct 30 2018 18:09
I am
I'm just struggling trying to come up with a strategy to make sure that numbers can't have more than one decimal point, no matter the format (like #.#. or ######.####.### etc)
@ezioda004
Oct 30 2018 18:11
How are the values stored? In a string?
Amit Patel
@AmitP88
Oct 30 2018 18:11
I was also trying to refactor my code to maybe put each number into it's own array, but that didn't work as I hoped either (other things didn't work as expected)
in an array
initial state starts as an empty array
if you go to the sandbox you'll see how I did it
Jason Luboff
@JLuboff
Oct 30 2018 18:12
Couple different ways you can check for more than one decimal. You could set a flag when a decimal is used, and not allow it if its true. You could use regex to identify an extra decimal. You could use an array and check if a decimal already exists in the array, etc
@ezioda004
Oct 30 2018 18:16
^^
Amit Patel
@AmitP88
Oct 30 2018 18:18
@JLuboff oh I see. I forgot about regex (I always sucked at it lol). I'll look into the flagging part though, I've heard of it, but I don't know what that is exactly
Jason Luboff
@JLuboff
Oct 30 2018 18:21
@AmitP88 Flag meaning a variable that you set to true or false based on some criteria
Amit Patel
@AmitP88
Oct 30 2018 18:22
oh I see, kind of like having a count variable, but this one is just to toggle between true and false?
Jason Luboff
@JLuboff
Oct 30 2018 18:23
Ya
Amit Patel
@AmitP88
Oct 30 2018 18:24
so I could use this while checking the input array against a regex? would that be a good way?
Jason Luboff
@JLuboff
Oct 30 2018 18:26
I don't know that you would really need to use regex at that point. Check the latest input and your flag variable, if flag is false, than you know that you don't already have a decimal, so you allow it. If flag is true, don't allow that input
Darren
@DarrenfJ
Oct 30 2018 18:27
fCC helproom! hello world!
Kyle Holm
@thekholm80
Oct 30 2018 18:28
@DarrenfJ :wave:
Amit Patel
@AmitP88
Oct 30 2018 18:30
@JLuboff I see. What about if the input array is like this though? [12.455 * 2222.3234 / 231.800] where there are multiple decimals, but just in different numbers (I've tried placing each number in it's own array, but it ends up breaking different things)
Jason Luboff
@JLuboff
Oct 30 2018 18:32
Probably work with a string for input until an operand is pressed at which point the current string should be placed into an array, etc
Amit Patel
@AmitP88
Oct 30 2018 18:35
so make it like this ['12.455' * '2222.3234' / '231.800'] ?
except when an operator is pressed, it turns to this [['12.455'] * ['2222.3234'] / ['231.800']]?
Jason Luboff
@JLuboff
Oct 30 2018 18:36
You'd want each element seperated..than you'll have to determine once the = button how to handle it. I had used .eval() for my calculator (long ago) but it is not very secure
Beans
@willybeans
Oct 30 2018 18:36
I'm wondering if its possible to populate an email through a react app? I have a bunch of text that i want the user to be able to click an "email" button and have it jump to their email with an email already composed for them. Is this possible? I remember doing this with a twitter post in the random quote challenge, so would this be going through the individual clients specific email api?
Jason Luboff
@JLuboff
Oct 30 2018 18:38
Thats if you want to strictly do front end emailing and I'd assume they have to have a email client setup
Probably better to handle it on the backend (if you haveo ne)
Beans
@willybeans
Oct 30 2018 18:39
@JLuboff i do have a backend
Amit Patel
@AmitP88
Oct 30 2018 18:39
@JLuboff hmm, I see. ok, i'll think about it and try to piece it together. Thanks man
Jason Luboff
@JLuboff
Oct 30 2018 18:40
Personally I would have the backend handle the emailing
Beans
@willybeans
Oct 30 2018 18:40
@JLuboff Thanks for searching, for some reason i havent been able to word my search to get any meaningful/helpful resources
Jason Luboff
@JLuboff
Oct 30 2018 18:40
@willybeans This is what I had searched javascript send email
@willybeans This might be of interest too https://smtpjs.com/
Beans
@willybeans
Oct 30 2018 18:41
@JLuboff haha perhaps mine was too verbose! : "how to forward app content to email in react"
@JLuboff I appreciate this help! Im going to read into using the second anwer on that stack overflow. it talks about doing it through node instead of the front end.
many thanks!
Jason Luboff
@JLuboff
Oct 30 2018 18:42
:thumbsup: nodeMailer is a great node package that I use
Darren
@DarrenfJ
Oct 30 2018 18:50
@thekholm80 buddy! glad to see yer still hanging around :smiley:
Kyle Holm
@thekholm80
Oct 30 2018 18:50
@DarrenfJ mostly lurking these days, got a lot going on
Darren
@DarrenfJ
Oct 30 2018 18:50
me too me too.. but only pop in once a week now at most..
whatcha been up to?
Kyle Holm
@thekholm80
Oct 30 2018 18:51
working, mostly. i'm on vacation this week, heading out of town tomorrow
good times
@Reaperoot_gitlab
Oct 30 2018 18:51
hey i get this to display the output:

def generateHost():
charSet = 'abcdefghijklmnopqrstuvwxyz1234567890'
length = 5

return random.choice(charSet), range(length)+' '+random.choice(charSet), range(length)+' '+random.choice(charSet), range(length)+' '+random.choice(charSet), range(length)+' '+random.choice(charSet), range(length)
print (generateHost);

yj
@atangyj
Oct 30 2018 18:54
Hi all, I’ve been learning coding by myself for a while, from html/css, js, and React. However, I found the part I most struggle with is css. Is there any suggestion of how to master it and understand how the properties work? Thanks.
Niraj Nandish
@Nirajn2311
Oct 30 2018 18:54
Has anyone used travis-ci cli here
@ezioda004
Oct 30 2018 19:03
@atangyj Have you completed the CSS section in fcc? Its pretty good.
yj
@atangyj
Oct 30 2018 19:05
I’ve learn css on other platform so I skip that part on fcc. I’ll have a look. Thanks.
Darren
@DarrenfJ
Oct 30 2018 19:13
Kyle Holm
@thekholm80
Oct 30 2018 19:13
@DarrenfJ california/nevada to see some friends
Niraj Nandish
@Nirajn2311
Oct 30 2018 19:56
:snowflake: :snowflake:
BuntyBru
@BuntyBru
Oct 30 2018 20:04
@thekholm80 happy journey
Kyle Holm
@thekholm80
Oct 30 2018 20:06
@BuntyBru thanks my dude
BuntyBru
@BuntyBru
Oct 30 2018 20:07
how have you been
?
Kyle Holm
@thekholm80
Oct 30 2018 20:07
good, good
you?
BuntyBru
@BuntyBru
Oct 30 2018 20:17
just the same
lot of work
lot of listening music
Kyle Holm
@thekholm80
Oct 30 2018 20:25
good deal
OblivioNemon
@OblivioNemon
Oct 30 2018 20:36

Hello! I'm trying to make a function that will modify an outer variable like so;

    <script>
var Score = 0;
function game(){
Score + 1;
return Score
}
game()
</script>

However, this function only returns 'Score' as 0. Does anyone know how to solve this?

@ezioda004
Oct 30 2018 20:37
@OblivioNemon You're not assigning the Score + 1 to itself.
Jason Luboff
@JLuboff
Oct 30 2018 20:38
Also.. just as best practice, Score should be all lower case
BuntyBru
@BuntyBru
Oct 30 2018 20:43
onEnterBranch()
{
for(var i =0;i<this.selectedItems.length;i++)
{
this.items.push(this.selectedItems[i].itemName);
this.itemsId.push(this.selectedItems[i].id);
}
for(var i =0 ;i <this.finalDisplayRB.length;i++)
{
if (this.districtBranch == this.finalDisplayRB[i].district.name_of_District)
{
this.checkDuplicate=1;
this.finalDisplayRB[i].district.items = this.arrayUnique(this.finalDisplayRB[i].district.items.concat(this.items));
this.finalDisplayRB[i].district.itemsId = this.arrayUnique(this.finalDisplayRB[i].district.itemsId.concat(this.itemsId));

this.items=[];
this.itemsId=[];
this.selectedItems=[];
this.stateInputBranch='';
this.districtBranch='';
}
else
{
if(this.checkDuplicate==1){
this.checkDuplicate=0;
}}}

if(this.checkDuplicate!=1 )
{
this.finalDisplayRB.push(
{
stateName:this.stateInputBranch,
district:{
name_of_District:this.districtBranch,
items:this.items,
itemsId:this.itemsId
}
});
}
this.items=[];
this.itemsId=[];
this.districtInputBranch="";
this.stateInputBranch="";
this.selectedItems=[];

}

the finalDisplayRB consist of a statename, and a district entity , Now if the district is same for another entry , i do not want it to get entered into finalDisplayRB
But even after using the checkDuplicate variable, sometimes null value is inserted into the array of objects finalDisplayRB
I know i should have used boolean
but the logic is same

Can anybody tell me a turnaround

OblivioNemon
@OblivioNemon
Oct 30 2018 20:43
Oh yes you're right thanks @JLuboff . And sorry @ezioda004 could you explain further what you mean by how I'm not assigning Score + 1 to itself?
@ezioda004
Oct 30 2018 20:44
@OblivioNemon You need to assign the value back to the variable like Score = Score + 1;.
BuntyBru
@BuntyBru
Oct 30 2018 20:45
the finalDisplayRB consist of a statename, and a district entity , Now if the district is same for another entry , i do not want it to get entered into finalDisplayRB
OblivioNemon
@OblivioNemon
Oct 30 2018 20:45
Oh of course! Thank you @ezioda004
@OblivioNemon Score + 1 is just an expression which will evaluate to a value, if you dont assign it back to variable, it will be discarded.