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
CamperBot
@camperbot
rafaelmonroy sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4488 | @masd925 |http://www.freecodecamp.com/masd925
rafaelmonroy
@rafaelmonroy
@Masd925 lol so just another for or while loop instead?
Markus Kiili
@Masd925
@rafaelmonroy You don't need the for in loop at all there.
Just remove the for...in loop and the if.
rafaelmonroy
@rafaelmonroy
@Masd925 ohh yeah, that works too
Markus Kiili
@Masd925
@rafaelmonroy No need to loop the properties, when you can just access.
rafaelmonroy
@rafaelmonroy
@Masd925 this is the part that returns the pair correct? obj[array[i]]
Markus Kiili
@Masd925
@rafaelmonroy Yes. array[i] is the character and obj[array[i]] gets the character pair from the obj.
rafaelmonroy
@rafaelmonroy
@Masd925 thanks!
Ebinezar Dhanaraj
@Ebiislearning

I have been using an web app which lists a set of records, I want certain information available on all the records to be highlighted/formatted. I am using jQuery (Tamper Monkey - Chrome plugin) to highlight/format the information that I need. However, I see that the div ids for these keeps on changing for each record and the class name remains the same.

Is there any other way to identify the divs or the classes ? Please find below the code snippet of a record.

‘’’

<div class="form-group col-sm-6" data-test-detail-field=“Bucket”>
<label class="col-sm-5 text-ellipsis" title="Infer Bucket">Bucket</label>
<div class="col-sm-7">
<div id="ember5757" class="ember-view">
<div id="ember5758" class="ember-view">
<span id="ember5759" data-original-title="D" data-placement="bottom" data-toggle="tooltip" data-container=".viewport" class="ember-view" style="word-wrap: break-word;">D</span>
</div>
</div>
</div>
</div>
‘’’

korzo
@korzo
@Ebiislearning Which elements you need?
Ebinezar Dhanaraj
@Ebiislearning
I need the value of the field “Bucket”, span id is ember5759, div id is ember5757
korzo
@korzo
@Ebiislearning You can use attribute selector like
$('[id^=ember]')
Ebinezar Dhanaraj
@Ebiislearning
there or other elements in the same page with id starting with ember.

‘ <div class="row mg-b-15">
<div class="clearfix"></div>
<div class="form-group col-sm-6" data-test-detail-field="Work">
<label class="col-sm-5 text-ellipsis" title="Work">Work</label>
<div class="col-sm-7"><div id="ember4440" class="ember-view"><div id="ember4441" class="ember-view text-muted"> Not available
</div>
</div></div>
</div>
<!----> <div class="form-group col-sm-6" data-test-detail-field="Contact Attempts">
<label class="col-sm-5 text-ellipsis" title="Contact Attempts">Contact Attempts</label>
<div class="col-sm-7"><div id="ember4443" class="ember-view"><div id="ember4444" class="ember-view text-muted"> Not available
</div>
</div></div>
</div>
<div class="clearfix"></div>
<div class="form-group col-sm-6" data-test-detail-field="Mobile">
<label class="col-sm-5 text-ellipsis" title="Mobile">Mobile</label>
<div class="col-sm-7"><div id="ember4446" class="ember-view"><div id="ember4447" class="ember-view text-muted"> Not available
</div>
</div></div>
</div>
<!----> <div class="form-group col-sm-6" data-test-detail-field="Email">
<label class="col-sm-5 text-ellipsis" title="Email">Email</label>
<div class="col-sm-7"><div id="ember4449" class="ember-view"> <a class="text-wrap" title="smitajan12@gmail.com" data-ember-action="4450">
smitajan12@gmail.com
</a>

</div></div>
</div>
<div class="clearfix"></div>
<div class="form-group col-sm-6" data-test-detail-field="Owner">
<label class="col-sm-5 text-ellipsis" title="Owner">Owner</label>
<div class="col-sm-7"><div id="ember4451" class="ember-view"><div id="ember4452" class="ember-view"> <span id="ember4453" data-original-title="Ebinezar Dhanaraj" data-placement="bottom" data-toggle="tooltip" data-container=".viewport" class="ember-view" style="word-wrap: break-word;">Ebinezar Dhanaraj</span>

</div>
</div></div>
</div>
<!----> <div class="form-group col-sm-6" data-test-detail-field="Signup Date">
<label class="col-sm-5 text-ellipsis" title="Signup Date">Signup Date</label>
<div class="col-sm-7"><div id="ember4455" class="ember-view"><div id="ember4456" class="ember-view"> <span id="ember4457" data-original-title="Fri Sep 15, 2017" data-toggle="tooltip" data-placement="bottom" data-container="body" class="text-ellipsis ember-view"> Fri Sep 15, 2017
</span>

</div>
</div></div>
</div>
<div class="clearfix"></div>
<div class="form-group col-sm-6" data-test-detail-field="Channel Manager">
<label class="col-sm-5 text-ellipsis" title="Channel Manager">Channel Manager</label>
<div class="col-sm-7"><div id="ember4459" class="ember-view"><div id="ember4460" class="ember-view text-muted"> Not available
</div>
</div></div>
</div>
<!----> <div class="form-group col-sm-6" data-test-detail-field="Infer Bucket">
<label class="col-sm-5 text-ellipsis" title="Infer Bucket">Infer Bucket</label>
<div class="col-sm-7"><div id="ember4462" class="ember-view"><div id="ember4463" class="ember-view"> <span id="ember4464" data-original-title="D" data-placement="bottom" data-toggle="tooltip" data-container=".viewport" class="ember-view" style="word-wrap: break-word;">D</span>

</div>
</div></div>
</div>
<div class="clearfix"></div>
<div class="form-group col-sm-6" data-test-detail-field="Customer Status">
<label class="col-sm-5 text-ellipsis" title="Customer Status">Customer Status</label>
<div class="col-sm-7"><div id="ember4466" class="ember-view"><div id="ember4467" class="ember-view"> <span id="ember4468" data-original-title="Trial" data-placement="bottom" data-toggle="tooltip" data-container=".viewport" class="ember-view" style="word-wrap: break-word;">Trial</span>

</div>
</div></div>
</div>'

so ember is there as part of every element
korzo
@korzo
@Ebiislearning You can use direct child selector > or method .children()
$('.col-sm-7 > [id^=ember]:first-child')
Ebinezar Dhanaraj
@Ebiislearning
Ok. Will try that out.
Thanks a lot :)
Johnny
@JohnnyBizzel
@Ebiislearning Gist is good https://gist.github.com/
林欣荣
@golovefree24
please,in regular expression :/[\W_]/g ,what means of underline?
korzo
@korzo
@golovefree24 [] is group of characters
underline is literal underline
Luke-Rogerson
@Luke-Rogerson
Guys, I'm trying to return the largest number in each nested array
I'm trying to use .map and .reduce to do this.
Antonious Stewart
@Antonious-Stewart
who here is good at regex
Luke-Rogerson
@Luke-Rogerson
Would anyone mind glancing at my Repl and telling me if I'm on the right track?
cowCrazy
@cowCrazy
@Luke-Rogerson you are almost there. Just instead of trying to assign the returning value from reduce to the maxNumber var return it.
@Astewart400 wouldn't say "good" but hit me :)
Luke-Rogerson
@Luke-Rogerson
@cowCrazy Thank you so much!
CamperBot
@camperbot
luke-rogerson sends brownie points to @cowcrazy :sparkles: :thumbsup: :sparkles:
:cookie: 347 | @cowcrazy |http://www.freecodecamp.com/cowcrazy
Jonathan Cunanan
@jcunanan05
hello little question. i have a function, will the code return ! _.isEmpty first and don't wait for the asynchronous call?
function isLoggedIn() {
  if (loggedInDetailsAlreadyFetched) {
    this.getLogin()
      .then();
      .catch();
  } 

  return ! _.isEmpty(userDetails);

}
Ken Haduch
@khaduch
@jcunanan05 - is this the callback for your asynchronous call? If it is, it will not be triggered until you get a return from the call, so it should work. But if the async call is this.getLogin() then I think you will do the return of !_.isEmpty(userDetails); first, it will not wait. You should put that check within the .then() method.
Jonathan Cunanan
@jcunanan05
@khaduch the async call is this.getLogin. :( so it won't wait. Thanks :) but if I put an else clause to the !_. isEmpty(user details) ;, will it wait?
CamperBot
@camperbot
jcunanan05 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3295 | @khaduch |http://www.freecodecamp.com/khaduch
korzo
@korzo
@jcunanan05 If condition is false, then async call is not triggered.
But your function will be inconsistent
Maciej Dębowski
@debofsky
Hello!
I have a question, don't know if it's so related to programming, or more to learning per-se and discovering, but on the edge to cheating.
Currently I'm working on "Title Case a Sentence" and I have some ideas how to tackle this problem.
However after finishing previous challenges I googled a little and found out about "cleaner" ways to solve problems. They were mostly about functional programming and using filter, map and reduce.
So far, when I think about "Title Case a Sentence" i see: applying lowercase, a loop (possibly more than one, and possibly nested), and applying uppercase. I hope I'm not spoiling anything. It's just brute-force, plain and simple, the way I like, but the code is quite long (compared to what I saw with neat solutions via previous challenges) and... let's say not elegant.
What do you think? Is it okay to google first, analaze some "perfect" solutions, and apply them on my own?
Markus Kiili
@Masd925
@debofsky It is better to try it on your own at first and then look for better solutions. If you always look first, making code from scratch might become a problem.
Adit
@adittyagi
Hey guys. How to use a single button to change bg-color and update the new message in random quote machine ?
Elizabeth Paul
@Kowalatam
$("the_button").on("click", function(){
    //change background color
   //update message
})
@adittyagi
something like that if jquery
just put all u want to happen if the button is clicked
imperial-isms
@imperial-isms
I finished everything up through intermediate projects; I’m having trouble getting through intermediate algorithms…stuck on roman numerals; tried even shifting over to https://edabit.com and doing some of the easier ones…my brain seems like it’s having trouble getting into the groove.
Do you think I should just work on something else and come back to algorithms?
Maybe I’ll be in a more ideal state tomorrow.