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
LydaTech
@lydatech
@pragya1248 its on the left
pragya1248
@pragya1248
oh yeah
sorry
LydaTech
@lydatech
@pragya1248 so did you need help?
Stephen James
@sjames1958gm
@relentless-coder So just plain HTML/CSS no React or Angular or other rendering framework?
Ayush Bahuguna
@relentless-coder
@sjames1958gm ejs templates rendered as html through nodejs
Stephen James
@sjames1958gm
@relentless-coder THat is odd, if everything is already loaded then I wouldn't expect scrolling issues.
Any dynamic (js) behavior on scrolling.
Ayush Bahuguna
@relentless-coder
@sjames1958gm yes, I am toggling display of a div based on the scroll height.
let me try removing that first
Stephen James
@sjames1958gm
@relentless-coder I don't have any special insight, just asking the questions I'd ask myself
A. J. Bozdar
@moajday
Does prompt function accept integers?
dinesh
@1532j0004kg

function pairElement(str) {
 var arr = [[],[]];
 var i = 0;
 // return    len = str.length;
 while(i < str.length)
  {
      if(str[i] == 'G')
        {
          arr[i][0] ="G";
          arr[i][1] = "C";
        }
  //if(str[i] == 'C')
    //    {
      //    arr[i][0] ="G";
        //  arr[i][1] = "C";
       // }

    /*  if(str[i] == 'C')
        {
          arr[i][0] ="C";
          arr[i][1] = "G";
        }

      if(str[i] == 'T')
        {
          arr[i][0] = "T";
          arr[i][1] = "A";
        }
      if(str[i] == 'A')
        {
          arr[i][0] = "A";
          arr[i][1] = "T";
        } 
 */   
      i++;
    }
  return arr;
}
pairElement("GCG");
Stephen James
@sjames1958gm
@ajbozdar How do you mean accept?
You give integer to prompt to display?
User enters integer?
@1532j0004kg Since you don't know string.length ahead of time, you should probably add to arr a different way rather than
with hardcoded two []
dinesh
@1532j0004kg
this code shows the error
but when i replace the i with 0 , its executing , can u please help me to solve this !
A. J. Bozdar
@moajday
I ask user to enter a number then I want to add and console log the addition.
Ghost
@ghost~5a4a80acd73408ce4f859755
trynna design a webpage for a porject, but not really creative, can anyone give me ideas please?
A. J. Bozdar
@moajday
let addition = prompt("Your Number");
let sum = (addition + 7);
console.log(sum);
This is what I am trying to do.
However I get concatenation in the end.
Stephen James
@sjames1958gm
@ajbozdar The user can enter a number, but the value returned is a string.
use parseInt to convert string to number
A. J. Bozdar
@moajday
parseInt ???
dinesh
@1532j0004kg
@sjames1958gm can u explain better , please
Ayush Bahuguna
@relentless-coder
@sjames1958gm hey, i figured it out. I accidentally placed code highlighting service inside the scroll event .
dinesh
@1532j0004kg
then how " if i giving the value directly " it works ?
Stephen James
@sjames1958gm
@relentless-coder Cool ! Always fun to find the problem
dinesh
@1532j0004kg

function pairElement(str) {
 var arr = [[],[]];
 var i = 0;
 // return    len = str.length;
 while(i < str.length)
  {
      if(str[i] == 'G')
        {
          arr[0][0] ="G";
          arr[0][1] = "C";
        }
  //if(str[i] == 'C')
    //    {
      //    arr[i][0] ="G";
        //  arr[i][1] = "C";
       // }

    /*  if(str[i] == 'C')
        {
          arr[i][0] ="C";
          arr[i][1] = "G";
        }

      if(str[i] == 'T')
        {
          arr[i][0] = "T";
          arr[i][1] = "A";
        }
      if(str[i] == 'A')
        {
          arr[i][0] = "A";
          arr[i][1] = "T";
        } 
 */   
      i++;
    }
  return arr;
}
pairElement("GCG");
like this
Stephen James
@sjames1958gm
@1532j0004kg var arr = [[], []] this assumes only two values in the string.
A. J. Bozdar
@moajday
@sjames1958gm This is interesting.
Stephen James
@sjames1958gm
@1532j0004kg Push the new array onto arr
@1532j0004kg like arr.push(["G", "C"]);
start with arr empty
@ajbozdar did you get it?
A. J. Bozdar
@moajday
I get it. @sjames1958gm Is it possible to do without parseInt? I'm sharing my function now.
function add7() {
        let addition = parseInt(prompt('your integer please')) + 7;
        console.log(addition);
    }
    add7();
dinesh
@1532j0004kg
@sjames1958gm thanks
CamperBot
@camperbot
1532j0004kg sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8931 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
@ajbozdar Well you can use a leading + to convert a string to number
var one = "1"
+one + 2
A. J. Bozdar
@moajday
Is my function useful? @sjames1958gm
Stephen James
@sjames1958gm
@ajbozdar If you need to add 7 a lot then yes :)
A. J. Bozdar
@moajday
@sjames1958gm Thank you :D
CamperBot
@camperbot
ajbozdar sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8932 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
@ajbozdar Well, let me say that a function should probably return the addition
function add7() {
        let addition = parseInt(prompt('your integer please')) + 7;
        return addition;
    }
@ajbozdar A more javaScript way would be to remove the addition variable;
function add7() {
        return  parseInt(prompt('your integer please')) + 7;
    }
dinesh
@1532j0004kg
@sjames1958gm its working suuccessfully , but still i have a dought .

function pairElement(str) {
 var arr = [[],[]];
 var i = 0;

 while(i < str.length)
  {
      if(str[i] == 'G')
        {
          arr[0][0] ="G";
          arr[0][1] = "C";
        }
  if(str[1] == 'C')
        {
          arr[1][0] ="G";
          arr[1][1] = "C";
        }

      i++;
    }
  return arr;
}
pairElement("GCG");
how its working ?
it output correctly !!!