Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 01 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 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
Markus Kiili
@Masd925
@sfshameem5 You could make an expression parser that evaluates the typed expression.
shameem fairooz
@sfshameem5
@Masd925 A function which does that ?
Markus Kiili
@Masd925
@sfshameem5 Yes.
shameem fairooz
@sfshameem5
@Masd925 Is it bad to use eval() for calculations ?
hansUno2
@hansUno2
Yes.. Even the docs say to never use it
Markus Kiili
@Masd925
@sfshameem5 Using eval is bad for security and performance reasons, so you should avoid it.
shameem fairooz
@sfshameem5
@Masd925 Will modify and let you know.
Markus Kiili
@Masd925
@sfshameem5 There are known algorithms for parsing expressions, but you can also do your own by making the expression simpler and simpler starting from the highest priority operations etc.
shameem fairooz
@sfshameem5
@Masd925 Which one would you recommend ?
Markus Kiili
@Masd925
@sfshameem5 Whatever suits you.
Jefferson
@jeffersonnnn
@hansUno2 thanks man, but i am not looking for an API for quotes. I am looking to share the quotes, and i haven't been able to get the method
CamperBot
@camperbot
jeffersonnnn sends brownie points to @hansuno2 :sparkles: :thumbsup: :sparkles:
:cookie: 16 | @hansuno2 |http://www.freecodecamp.org/hansuno2
shameem fairooz
@sfshameem5
@Masd925 Will try the second option.
hansUno2
@hansUno2
@jeffersonnnn to post it on twitter?
Jefferson
@jeffersonnnn
@hansUno2 yes yes
shameem fairooz
@sfshameem5
hansUno2
@hansUno2
@jeffersonnnn you have to read the directions on the twitter page, no API needed
Jefferson
@jeffersonnnn
@sfshameem5 thanks man. i appreciate
CamperBot
@camperbot
jeffersonnnn sends brownie points to @sfshameem5 :sparkles: :thumbsup: :sparkles:
:cookie: 310 | @sfshameem5 |http://www.freecodecamp.org/sfshameem5
hansUno2
@hansUno2
@sfshameem5 how are you calculating you expression with your calc app?
I tried it but could no get an answer
Jefferson
@jeffersonnnn
@hansUno2 could you show me directions to this page?
shameem fairooz
@sfshameem5
@hansUno2 Used eval() but it ain't recommended. Might have to create a function to validate expressions
hansUno2
@hansUno2
@jeffersonnnn
Jefferson
@jeffersonnnn
@hansUno2 so i went to the link and i am going through the javascript api end. The problem however is that i am building my app in React, not pure js
hansUno2
@hansUno2
@jeffersonnnn read this section--> "How to add a Tweet button to your websit". the link posted by @sfshameem5
@jeffersonnnn not sure how you would do it with react
@sfshameem5 are the numbers being displayed in an input element?
Javier Pons
@JavierPons
Hi there!
<html>
  <h1>Type a number between 1 - 10</h1>
  <form action="" name="form1">
    <input type="text" name="text" width="20px">
    <button onClick="init()">Press</button>
  </form>

</html>
var numb = Math.floor(Math.random() * 10 +1);

function init() {
  var inicio = document.form1.text.value;
  console.log("coge");
}

function check() {
  var count = 0;
  var acept = init();


   if(acept == numb) {
     showWin();
     count++;
   } else if( acept !== numb) {
             showError();
     count++;
   } else if((acept !== numb) && (count == 5 )) {
     showLoss();
     count++;
   }

}

function showWin() {
  console.log("gano!");
}

function showError() {
  console.log("perdio");
}

function showLoss() {

  console.log("mas de cinco veces, perdio");
}
hansUno2
@hansUno2
Hi
shameem fairooz
@sfshameem5
@hansUno2 A <div> element
Javier Pons
@JavierPons
is it function init() taking the value of the input?
some vision, if you can ...
hansUno2
@hansUno2
No
Claudio Restifo
@Marmiz
@JavierPons it's onclick in vanilla JS, onClick is general for react, vue and the other frameworks
hansUno2
@hansUno2
Document.form1.text is not defined as far as i can see
Javier Pons
@JavierPons
ok!
Claudio Restifo
@Marmiz
@JavierPons then to get the input value it's probably way easier to use getElementByID().value
Javier Pons
@JavierPons
you are right!
hansUno2
@hansUno2
@JavierPons yes. Or querySelector
You have to specify the elemen name , class, or id
Javier Pons
@JavierPons
:+1:
Javier Pons
@JavierPons
@Marmiz @hansUno2 thanks!
CamperBot
@camperbot
javierpons sends brownie points to @marmiz and @hansuno2 :sparkles: :thumbsup: :sparkles:
:cookie: 17 | @hansuno2 |http://www.freecodecamp.org/hansuno2
:star2: 1214 | @marmiz |http://www.freecodecamp.org/marmiz
Sundeep
@pidugusundeep
@camperbot thanks