Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 2020 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
BEL. Yacine
@ByZource
okay, I will try that :D
Darth Skywalker
@adityaparab
function getRandom(limit) {
  return Math.ceil(Math.random() * max);
}

var colors = ["red","blue","black","yellow"];
var currentColor = colors[0];
var newColor = '';
$("body").css("background-color", currentColor );

$("#nextbtn").on("click", function (e) {
  while(newColor != currentColor){
    newColor = colors[getRandom(colors.length)];
  }
  $("body").css("background-color", currentColor );
  currentColor = newColor;
});
@ByZource
Faisal Zulfiqar
@faisal-zulfiqar
I have this website http://ifrnd.org/main/ and I want to make the grey background to occupy full width of the page in the "Welcome" section. It's placed inside a container. So I have to use position = absolute. But that breaks things up and it doesn't stays responsive. Any help will be highly appreciated. SOMEBODY?
c0d0er
@c0d0er
does anybody know why the following jquery code doesnt work?
const tableMaker = () => {
  const app = document.getElementById('app');
  //const table = document.createElement('TABLE');
  const table = $('<table></table>')//---->why doesnt work?
  //const tableBody = document.createElement('TBODY');
  const tableBody = $('<tbody></tbody>')//---->why doesnt work?
  //table.appendChild(tableBody);
  table.append(tableBody);

  for(let i=0; i<25; i++){
    const tr = document.createElement('TR');
    tableBody.appendChild(tr);
    for(let j=0; j<40; j++){
      const td = document.createElement('TD');
      $(td).append(j)
      $(tr).append(td);
    }
  }
  $(app).append(table)
}
Mostafa Masri
@thefakeweed
hey guys im unable to change the color of the text of my buttons http://codepen.io/mml3b/pen/KaamPX
form action
Sorin Ruse
@sorinr
@mml3b first u should use form tag only once to wrap all your inputs
Mostafa Masri
@thefakeweed
ohh
how can i do that ?
Sorin Ruse
@sorinr
@mml3b it should be like <form><input><input>....</form?
Mostafa Masri
@thefakeweed
didnt get it
do i have to nest something inside something :/
Sorin Ruse
@sorinr
@mml3b you changed your pen in the mean time. first you had 3 buttons there
Mostafa Masri
@thefakeweed
yup i did
how can i correct it as you said
Sorin Ruse
@sorinr
@mml3b you just need to place all your inputs inside the form tag
Mostafa Masri
@thefakeweed
but i have different form actions for every input
Sorin Ruse
@sorinr
@mml3b then do not use action="http://google.com/+thefakeweed"> into the form. instead of inputs u can just use <a href="url in here"> tags
Mostafa Masri
@thefakeweed
and where do i put this tag ? do i nest it into the input
Sorin Ruse
@sorinr
@mml3b in this case you don't need the form taags
@mml3b you just want to link some icons to some external resources. right?
Muhammad Hasham
@MuhammadHasham23
is ForEach() used in this example deprecated now
function forEach(array, action) 
{ 
for (var i = 0; i < array.length; i++) 
    action(array[i]); 
}
forEach(["Wampeter", "Foma", "Granfalloon"], console.log);
@sorinr
Bikal Khawas
@bikalkhawas
hello everyone, I got problem in my editor. My code works well in debug mode but won't work in editor view. Any help will be appreciated. This is my codepen https://codepen.io/bikal/pen/GrNpMw and my debug mode is http://s.codepen.io/bikal/debug/GrNpMw/bYMdyYByDdNr
Darth Skywalker
@adityaparab
@MohammadHasham It's not a part of js specification so there is no question of it getting deprecated. ;)
Do not confuse this forEach with Array.prototype.forEach
although they have similar signature and behavior, they aren't necessarily hosted on same object.
Clyde Lobo
@oppiniated
@bikalkhawas hint: debug mode runs on http, your editor view is on https, run your pen on http and it will work. I want you to find out why it does not work on https. SO try http://codepen.io/bikal/pen/GrNpMw and this should work
Bikal Khawas
@bikalkhawas
@oppiniated thank you so much, :smile:
CamperBot
@camperbot
bikalkhawas sends brownie points to @oppiniated :sparkles: :thumbsup: :sparkles:
:cookie: 509 | @oppiniated |http://www.freecodecamp.com/oppiniated
Muhammad Hasham
@MuhammadHasham23
@adityaparab so what is the difference between the both?
Darth Skywalker
@adityaparab

@MohammadHasham

@adityaparab so what is the difference between the both?

:point_up: This (2nd message)

Muhammad Hasham
@MuhammadHasham23
with Array.prototype.forEach we can traverse the array but what about the second one?
@adityaparab
Darth Skywalker
@adityaparab
you do exactly the same thing
Muhammad Hasham
@MuhammadHasham23
can you explain me this
function forEach(array, action) { for (var i = 0; i < array.length; i++) action(array[i]); }
forEach(["Wampeter", "Foma", "Granfalloon"], console.log); // → Wampeter // → Foma // → Granfalloon
why are we passing action with it
Darth Skywalker
@adityaparab

in fact, the function

function forEach(array, action) { 
  for (var i = 0; i < array.length; i++) 
    action(array[i]); 
}

explains how Array.prototype.forEach works internally.

Array.prototype.forEach = function(action){
  for (var i = 0; i < this.length; i++) 
    action(this[i]); 
}
Muhammad Hasham
@MuhammadHasham23
why is action passed as an argument?
Darth Skywalker
@adityaparab
it's nothing but a callback function.
Muhammad Hasham
@MuhammadHasham23
okay!
@adityaparab Thanks.
CamperBot
@camperbot
mohammadhasham sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 877 | @adityaparab |http://www.freecodecamp.com/adityaparab
Darth Skywalker
@adityaparab
take a look at this
var x = console.log

x('Hello! I am alias for console.log');
so the 2nd parameter action becomes an alias for console.log
Muhammad Hasham
@MuhammadHasham23
yeah! that is what i can understand!
okay thanks
Darth Skywalker
@adityaparab
and when you call action, you're in fact calling console.log