These are chat archives for FreeCodeCamp/HelpJavaScript

7th
Sep 2017
Adel
@AdelMahjoub
Sep 07 2017 00:03
@intcreate I got the opposite sense https://jsbin.com/toboqafeka/1/edit?js,output
Randell Dawson
@randelldawson
Sep 07 2017 00:14
@dyon3334 - I answered in the other channel.
Adel
@AdelMahjoub
Sep 07 2017 00:15
@piteto cool, less code with css
@piteto and better perf than setInterval
juni
@junipberry
Sep 07 2017 00:33
hi guys, I’m trying to give the properties of obj2 to obj1. Is this the right way about it?
function extend(obj1, obj2) {
  if (obj1[key]===true){
  return obj1 === obj2[key];
}
}
Coy Sanders
@coymeetsworld
Sep 07 2017 00:34
@junipberry key isn't defined, you should look into the Object.keys and hasOwnProperty functions
Randell Dawson
@randelldawson
Sep 07 2017 00:35
@junipberry - question - what do you think your if statement is evaluating?
Caleb Cox
@CalebCox
Sep 07 2017 00:36
Hello everyone! I'm working on the Tic Tac Toe advanced project and I'm having some issues understanding how to properly implement minimax or similar algorithms to create an unbeatable AI for a board that's in a 2D array. Does anyone have any resources that would be helpful or any suggestions?
juni
@junipberry
Sep 07 2017 00:37
good point, ty @coymeetsworld. Fixing it now.
CamperBot
@camperbot
Sep 07 2017 00:37
junipberry sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
api offline
Randell Dawson
@randelldawson
Sep 07 2017 00:37
@CalebCox - why not attempt your own algorithm?
Coy Sanders
@coymeetsworld
Sep 07 2017 00:38
This helped for me @camperbot https://www.youtube.com/watch?v=J1GoI5WHBto
but, you dont need to implement minimax, making the game unbeatable was removed as a req over a year ago
Caleb Cox
@CalebCox
Sep 07 2017 00:39
@coymeetsworld thank you! I also didn't notice it wasn't a requirement any longer, the video still mentioned it but the side panel's user stories do not lol.
Coy Sanders
@coymeetsworld
Sep 07 2017 00:39
yw @junipberry
CamperBot
@camperbot
Sep 07 2017 00:39
calebcox sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
api offline
Randell Dawson
@randelldawson
Sep 07 2017 00:40
@CalebCox - This wiki gives some basic logic for AI.
Coy Sanders
@coymeetsworld
Sep 07 2017 00:40
you should try to make the game first, then try to make it unbeatable @CalebCox , it was fun learning how it worked (also tough)
Caleb Cox
@CalebCox
Sep 07 2017 00:41
@rmdawson71 thanks for the link, i'll reference that as well!
CamperBot
@camperbot
Sep 07 2017 00:41
calebcox sends brownie points to @rmdawson71 :sparkles: :thumbsup: :sparkles:
api offline
Gersho
@Gersho
Sep 07 2017 00:44
@CalebCox have you considered writing down how you would play to be unbeatable(as a set of rules to follow), and then translate that to code ?
such as: "if i'm O, and there's a line with 2 X" -> "i should interfere with that"
Caleb Cox
@CalebCox
Sep 07 2017 00:46
@Gersho actually that never crossed my mind as an idea to try. I'll write out some test cases and see what works! Thanks for the suggestion
CamperBot
@camperbot
Sep 07 2017 00:46
api offline
calebcox sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
Long Nguyen
@longnt80
Sep 07 2017 00:46
@CalebCox if you try that way, here's the strategy written down: https://www.quora.com/Is-there-a-way-to-never-lose-at-Tic-Tac-Toe
@CalebCox btw, in case you didn't know, unbeatable is not a requirement for that project
Gersho
@Gersho
Sep 07 2017 00:53
i actually had made that on mine and ended up removing it and making it random, tictactoe is supposed to be a children's game after all
piteto
@piteto
Sep 07 2017 00:57
@AdelMahjoub Your code reminds me how much I need to learn canvas :)
Adel
@AdelMahjoub
Sep 07 2017 01:39
Still not sure of the rotation direction https://jsbin.com/wawijobohe/edit?js,output
@intcreate if you don't like the image above, you can search for a better tiles sheet
Fernando
@lestairon
Sep 07 2017 02:00
Oh my
Gersho
@Gersho
Sep 07 2017 02:07
@lestairon what part ? if a challenge seems hard, try to separate it in smaller chunks to see what part is giving you trouble
Fernando
@lestairon
Sep 07 2017 02:12
I don't know how to do a share button and where should i take the random quotes
I'll try to do it
Wish me luck
Claudio Restifo
@Marmiz
Sep 07 2017 02:30
@lestairon For starter you don't need to pull the quotes from an API, you can simply create an Array of quotes and then pull out one at random.
After that simply switch from picking it one up from local to an API :)
Fernando
@lestairon
Sep 07 2017 02:40
I'd like to do it using an API
To know how it works
Bryan Reese
@breese8009
Sep 07 2017 02:41
heyyy whats this ~~ mean in JS?
Fernando
@lestairon
Sep 07 2017 02:53
Uh, @Marmiz Can i create an API using google sheets?
Wait, maybe i don't know exactly how that works, but i saw a video doing that but with Python
Fernando
@lestairon
Sep 07 2017 03:01
Nvm, that's not an API
It's a Database
Claudio Restifo
@Marmiz
Sep 07 2017 03:37
@lestairon yep :)
An API is different... you can create one for sure :)
How good are you at back end?
silver537
@silver537
Sep 07 2017 03:40
You use the same technique on the database as if you would using an api
Claudio Restifo
@Marmiz
Sep 07 2017 03:41
@breese8009 ~ is a negative bitwise operation in JS... so I assume ~~ is a double bitwise so maybe a double negative operation?
I guess it just remove the decimals at this point.... kinda like Math.floor()... but not sure at all.
Never saw it nor used it
Rafael Monroy
@rafaelmonroy
Sep 07 2017 04:16

@rafaelmonroy
hey guys what value can I set my data.stream equal so that my else if statement returns my desired info?

$(function(){
  var users = ["ESL_SC2", "freecodecamp", "noobs2ninjas", "realisticgamingyoutube"];
  var i = 0;
  while (i<users.length){
   $.ajax({
    type: 'GET',
    url: 'https://wind-bow.glitch.me/twitch-api/streams/'+users[i]+'/',
    success: function(data) {
      if (data.stream === null){
        console.log('offline')
        } else if (data.stream === true){
        console.log(data.stream.game + ', '+data.stream.stream_type)
        }     
      }
    })
    i++
  } 
});

it works when I remove the else if statement and just leave as an else statement, but am curious to know what value i can enter with an else if statement

Ogundele Olumide
@Lumexralph
Sep 07 2017 04:20
@rafaelmonroy what if you do
if (data.stream )  {
   console.log(data.stream.game + ', '+data.stream.stream_type)
}   else {
       console.log('offline');
}
Rafael Monroy
@rafaelmonroy
Sep 07 2017 04:21
@Lumexralph yeah that works but I want to know if possible with an else if statement
Ogundele Olumide
@Lumexralph
Sep 07 2017 04:22
@rafaelmonroy you can but it'll be a kind of repetition else if (data.stream)
did you try that?
Rafael Monroy
@rafaelmonroy
Sep 07 2017 04:23
yeah this worked
if (data.stream === null){
        console.log('offline')
        } else if (data.stream){
        console.log(data.stream.game + ', '+data.stream.stream_type)
        }
Ken Haduch
@khaduch
Sep 07 2017 04:23
@rafaelmonroy - null should be coerced to false so if your data.stream is not null, then i think you should be able to do else if (data.stream) { ? Which would essentially be the "else" statement.
Ogundele Olumide
@Lumexralph
Sep 07 2017 04:23
@rafaelmonroy what values will be in data.stream ?
Rafael Monroy
@rafaelmonroy
Sep 07 2017 04:24
@khaduch @Lumexralph yeah that worked guys, but I guess it is just repetition. Thanks!
CamperBot
@camperbot
Sep 07 2017 04:24
api offline
api offline
rafaelmonroy sends brownie points to @khaduch and @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Sep 07 2017 04:24
@rafaelmonroy yeah
cbot still on hols
CamperBot
@camperbot
Sep 07 2017 04:25
you called?
Rafael Monroy
@rafaelmonroy
Sep 07 2017 04:25
@camperbot ?
Ogundele Olumide
@Lumexralph
Sep 07 2017 04:25
have fun while brownies are thrown into space
Rafael Monroy
@rafaelmonroy
Sep 07 2017 04:25
whats up with the camper bot api offline?
Ogundele Olumide
@Lumexralph
Sep 07 2017 04:26
@khaduch looking at your profile pic.... should I say father or grandpa ?
@rafaelmonroy FCC can answer that
Ken Haduch
@khaduch
Sep 07 2017 04:36
@Lumexralph - grandfather for the second time...
Ogundele Olumide
@Lumexralph
Sep 07 2017 04:42
@khaduch awesome :clap:
Fernando
@lestairon
Sep 07 2017 05:03

@Marmiz I don't anything of Back end yet

@lestairon yep :)
An API is different... you can create one for sure :)
How good are you at back end?

Markus Kiili
@Masd925
Sep 07 2017 05:20
Browzniez are in space now?
Gersho
@Gersho
Sep 07 2017 05:21
we're on forced diet
Fernando
@lestairon
Sep 07 2017 05:24
Uh, i have a good idea for my Pen, but i don't know how can i do it
I'd like to have almost anything on the Html, and then add some things with Javascript, is that possible?
Ogundele Olumide
@Lumexralph
Sep 07 2017 05:25
@Masd925 lol.... Good Morning
Fernando
@lestairon
Sep 07 2017 05:25
Maybe using $(document)
Gersho
@Gersho
Sep 07 2017 05:27
@lestairon you can give id to your html elements, and then modify them with $("#id").html("blabla") (or .append depending on your need)
but "when" do you want those changes to happen ? when the user clicks ? after some time ?
because if you simply put the code like that in your js it's gonna modify the content right away and the user will never how it looked before the modifications
Fernando
@lestairon
Sep 07 2017 05:28
Can i put some empty html elements then modify it?
like <h1 id="number1"></h1>
Gersho
@Gersho
Sep 07 2017 05:30
of course
that's often used
displaying result, stuff like that
Fernando
@lestairon
Sep 07 2017 05:42
I have some ideas of how to do it, but i know many of them won't work
I'll try
Fernando
@lestairon
Sep 07 2017 05:49
@Gersho I was talking about something like this
https://codepen.io/chriscoyier/pen/MwaXpq
Gersho
@Gersho
Sep 07 2017 05:50
yeah, instad of "body" you use some element you gave an id
since you used append, you could (for exemple) have a button to get a new quote (by putting all that code inside a click event)
Fernando
@lestairon
Sep 07 2017 05:53
Yeah, it's better to do it using ids, that way i can organize better my page, i think
Gersho
@Gersho
Sep 07 2017 05:55
and it means you don't have do change everything, you can have your title in a <div>, and some other stuff in another
Fernando
@lestairon
Sep 07 2017 05:56
I was thinking about either API or array, i think i'll use both
If the api is down i can get the quotes from the arrays
Rafael Monroy
@rafaelmonroy
Sep 07 2017 08:02
hey guys just finished the JS part of my twitch api project but I am not sure if this user story is completed “I can click the status output and be sent directly to the Free Code Camp's Twitch.tv channel.” in the sample they give the user name is linked to the channel, I did the same in my app, but not sure if they wanted the the offline - online to be linked, which doesnt make too much sense now that I think about it but, just to be on the safe side, thought I’d ask one of you :wink: here is my pen (no design yet, just want to get a green light on the JS lol) https://codepen.io/rafaelmonroy/pen/xLewBM
Chris Cullen
@123xylem
Sep 07 2017 08:34

$ heroku pg:promote postgresql-defined-86594
Ensuring an alternate alias for existing DATABASE_URL... !
! postgresql-defined-86594 is already promoted on
! quiet-depths-47005
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IM putting a WP site on HEROKU>

IM trying to promote a database on heroku... It tells me its already promoted... I wouldnt mind but last time i went with this the site kept giving me error 500 and i assumed it was because I didnt fix this part of the install.
Any Help?

Chris Juchtmans
@kjuchtmans
Sep 07 2017 08:45
Goood mornin coders! :wave:

"JS Calculator" app :
Why is my JQuery not logging out an array with 1's when I click the 1 key of this calculator?
Here is my pen with html, css and JS

Any tips are welcome!
thanks, chris

Markus Kiili
@Masd925
Sep 07 2017 08:51
@kjuchtmans Console.log is not inside the click callback.
console.log is only executed once after the document is ready.
Chris Juchtmans
@kjuchtmans
Sep 07 2017 09:08

@Masd925 :hankey: beginners mistake, thanks Markus!
But then again, moving console.log() and my arr initalisation inside the callback fun still throws an undefined error in console:
'Uncaught ReferenceError: $ is not defined
at pen.js:243:1'

Code:

/* TAKE AWAY :
*/

$(function() {

    //array to hold all clicked values until result ( = ) is asked

    //add values of all clicked cells to an array
    $("#1").click(function(){
        var arr = [];
        arr.push(1);
        console.log(arr);
    });
});

modified pen here cheers

CamperBot
@camperbot
Sep 07 2017 09:08
kjuchtmans sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
api offline
Markus Kiili
@Masd925
Sep 07 2017 09:09
@kjuchtmans Initialization var arr = []; should be before the event handling code.
Markus Kiili
@Masd925
Sep 07 2017 09:14
@kjuchtmans $ not defined, means that you have not enabled jQuery on codePen.
Chris Juchtmans
@kjuchtmans
Sep 07 2017 09:15
haven't I?? let me look
@Masd925 Yaay ! the problem was me not using Codepen enough ; now I know one has to enable JQuery library from the external JS menu in Settings. Thanks again
CamperBot
@camperbot
Sep 07 2017 09:18
kjuchtmans sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
api offline
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:29
For string s = "a(bc)de", the output should be
reverseParentheses(s) = "acbde". goodtime to user regex no?
a(bcdefghijkl(mno)p)q" but then I got this and no idea how im gonna do it :D

You have a string s that consists of English letters, punctuation marks, whitespace characters, and brackets. It is guaranteed that the parentheses in s form a regular bracket sequence.

Your task is to reverse the strings contained in each pair of matching parentheses, starting from the innermost pair. The results string should not contain any parentheses.

Example

For string s = "a(bc)de", the output should be
reverseParentheses(s) = "acbde".

Chris Juchtmans
@kjuchtmans
Sep 07 2017 09:35

@tiagocorreiaalmeida Regex is mighty sweet and powerful to those who master it. I couldn't serve a solution to your q in a heartbeat, but may I refer you to this very meaty tutorial, written up by a compatriote of mine?

good luck!

Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:36
thanks @kjuchtmans
CamperBot
@camperbot
Sep 07 2017 09:36
tiagocorreiaalmeida sends brownie points to @kjuchtmans :sparkles: :thumbsup: :sparkles:
api offline
Chris Juchtmans
@kjuchtmans
Sep 07 2017 09:37
...its the sort of reading material for long winter evenings, I admit
Simon Cordova
@gbsimon87
Sep 07 2017 09:51
Hey all!
Gots a quick question...
I've got this website for which I can't seem to change the placeholder value at all for some reason, can anyone take a look?
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:51
sure
Simon Cordova
@gbsimon87
Sep 07 2017 09:53
@tiagocorreiaalmeida
Thanks buddy...
It's at cardfactory.co.uk
The search bar up top, here's the selector...
document.querySelector("#searchText")
$("#searchText")
CamperBot
@camperbot
Sep 07 2017 09:53
api offline
gbsimon87 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
Simon Cordova
@gbsimon87
Sep 07 2017 09:54
I need to change it with javascript though
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:56
this part?
image.png
Simon Cordova
@gbsimon87
Sep 07 2017 09:56
Yep :)
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:56
what you wanna do to it?
Simon Cordova
@gbsimon87
Sep 07 2017 09:56
So instead of "Search Cards, "Gifts & Party" I need it to show "Search for items"
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:57
is it ok to use jquery?
Simon Cordova
@gbsimon87
Sep 07 2017 09:57
yep
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:58
I think you can do something line
$("#searchText").attr("placeholder","blabla");
letm e try
:D
image.png
Simon Cordova
@gbsimon87
Sep 07 2017 09:59
Yeah, it changes it in the HTML, but I can't seem to change it in the actual screen
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 09:59
it does?
are you the owner of the website?
Simon Cordova
@gbsimon87
Sep 07 2017 10:00
Try it in mobile view
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:01
just a quick question why not change it in the html?
and will try to look for some workaround to this
      $("#searchText").attr("placeholder", "Search occassion, recipient, card or gift");
with this
defiend
gonna be hard
to overwrite it
Simon Cordova
@gbsimon87
Sep 07 2017 10:02

I appreciate it.

I don't have access to the HTML, I can only inject Javascript

Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:02
 myCode: function() {

            var $ = window.jQuery;

            $("#headerContainer > div.row.visible-xs > div").addClass("col-xs-4").removeClass("col-xs-1").css("width", "25%");

            $("#headerContainer > div.row.visible-xs > div > div").css("width", "100%");

            $("#headerContainer button").after("<span></span>");
            $("#headerContainer > div.row.visible-xs > div:nth-child(1) > div > span").text("Menu");
            $("#headerContainer > div.row.visible-xs > div:nth-child(3) > div > span").text("Stores");
            $("#headerContainer > div.row.visible-xs > div:nth-child(4) > div > span").text("Login");
            $("#headerContainer > div.row.visible-xs > div:nth-child(5) > div > span").text("Basket");

            $("#header > .visible-xs.visible-sm").insertAfter("#headerContainer");

            $("#headerContainer, #header > .visible-xs.visible-sm").wrapAll("<div class='reNavDiv'></div>");

            $("#headerContainer > div:nth-child(1)").prependTo("#header");

            $("#header > .row").wrap("<div class='reLogoDiv container'></div>");

            $("#searchContainer").removeClass("container");

            $("#searchText").attr("placeholder", "Search occassion, recipient, card or gift");

            $("#header > div:nth-child(6)").insertAfter(".reNavDiv");

            $("#lister-small-menu").appendTo(".reNavDiv");

            $(".navcontainer:not(.center)").appendTo(".reNavDiv");

            $("#searchContainer").removeClass("collapse");

            $("#headerContainer > div > div").on("click", function() {
                $(this).find("button").click();
            });

        }
can't you change this js file?
Simon Cordova
@gbsimon87
Sep 07 2017 10:04
That's my JS file lol
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:04
there's youir propblçem
     $("#searchText").attr("placeholder", "Search occassion, recipient, card or gift");
Simon Cordova
@gbsimon87
Sep 07 2017 10:04
Why's that?
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:04
change this
and update the js file to the website
then let me know
Simon Cordova
@gbsimon87
Sep 07 2017 10:05
Oh my I didn't event realise I had that in there, let me try it :)
I do appreciate the help btw
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:06
np
Simon Cordova
@gbsimon87
Sep 07 2017 10:07
Damn, that didn't quite work
Only for the desktop
Morchid Chellali
@Morched23MJ
Sep 07 2017 10:07
In the Tic Tac Toe, I made a return button as an icon, to go back, and change to 1/2 players, or change xo choice, when the game finishes between two players, I show the winner, if there is, else draw. So, at this point, that icon, keeps fading in/out, for some reason. :l here is the pen: https://codepen.io/Morched23MJ/pen/VzRQZM?editors=0010
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:09
@gbsimon87 can you just update the js file in the server or you only update everything at the end?
nm you allready did
Simon Cordova
@gbsimon87
Sep 07 2017 10:10
Yeah I did to 123, it works well on desktop but not on mobile
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:12
update the code to this
$("#searchText").attr("placeholder", "blabla");
remove the if statement
and tell me how it works
add that line in the place you commented the other
you have to search inputs on your html?
image.png
image.png
Simon Cordova
@gbsimon87
Sep 07 2017 10:21
Hey sorry, didn't see you had texted...
I just tried what you said
If it doesn't work I'm scrapping it
It may be another javascript overriding mine
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:21
you have 2 times the same input?
see the images
yeah that's the problem
so you will need to loop the ammount of elements
that has the id searchtext
that's it
Simon Cordova
@gbsimon87
Sep 07 2017 10:27
Ok I'll try that out as
well
thanks buds
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:27

window.addEventListener('DOMContentLoaded', function() {
var textbar= document.querySelectorAll('#searchText');

progress.forEach(function(element) {
element.setAttribute("placeholder", "blabla");
});
});

try this
wait

window.addEventListener('DOMContentLoaded', function() {
var textbar= document.querySelectorAll('#searchText');

textbar= (function(element) {
element.setAttribute("placeholder", "blabla");
});
});

notworking
will try soemthing unthil it works
Markus Kiili
@Masd925
Sep 07 2017 10:30
@tiagocorreiaalmeida You forgot the forEach on the last code?
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:31
yeah
but something seems to not be working in here
Simon Cordova
@gbsimon87
Sep 07 2017 10:35
@tiagocorreiaalmeida thanks buds I really appreaciate it
CamperBot
@camperbot
Sep 07 2017 10:35
gbsimon87 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
api offline
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 10:38
@gbsimon87

window.addEventListener('DOMContentLoaded', function() {
var textbar= document.querySelectorAll('#searchText');

textbar.forEach= (function(element) {
element.setAttribute("placeholder", "blabla");
});
});

try this
and tell me what happens
Markus Kiili
@Masd925
Sep 07 2017 10:41
@tiagocorreiaalmeida The syntax is nodeList.forEach(callback[, thisArg]);, not nodeList.forEach = callback
Kiwalabye Richard
@xdon55
Sep 07 2017 11:24
Hey guys please help me here. tell me the problem with my code. it only returns false.

function mutation(arr) {
  var lowerCaseArr = arr.map(function(x){
    return x.toLowerCase();
  });
   for(var j=0;j<lowerCaseArr[1].length;j++){
     var posOfLetter = lowerCaseArr[0].indexOf(j);
     if(posOfLetter !== -1){
       return true;

     } else {
       return false;
     }
   }
}

mutation(["hello", "hey"]);
Markus Kiili
@Masd925
Sep 07 2017 11:26
@xdon55 Your code is looking for a number j in the array here lowerCaseArr[0].indexOf(j);
Also, can you really return true if one looped character is found?
Aminu Ibrahim Abubakar
@AminuSufi585
Sep 07 2017 11:38
What do you want to do? @xdon55
Kiwalabye Richard
@xdon55
Sep 07 2017 11:41
@AminuSufi585 i want to return false if all letters of second string in arr are not found in the first string. and return true if otherwise.
Aminu Ibrahim Abubakar
@AminuSufi585
Sep 07 2017 11:42
Ok let me check your code I'll get back to you shortly
Aminu Ibrahim Abubakar
@AminuSufi585
Sep 07 2017 12:00
@xdon55 Do it this way
function mutation(arr) {
  var lowerCaseArr = arr.map(function(x){
    return x.toLowerCase();
  });

  for(var j=0;j<lowerCaseArr[1].length;j++){
     var posOfLetter = lowerCaseArr[0].indexOf(lowerCaseArr[1][j]);
     if(posOfLetter === -1){
       return false;
     } 
  }
  return true;
}

mutation(["hello", "hey"]);
You can see that, you need to include the index of the particular characters in the string as well
and also you need to test whether its not found in each iteration
No need of else, if everything was found after the loop
It means it was automatically true
Hope it helps @xdon55
Kiwalabye Richard
@xdon55
Sep 07 2017 12:11
@AminuSufi585 thanks. that helped alot
CamperBot
@camperbot
Sep 07 2017 12:11
xdon55 sends brownie points to @aminusufi585 :sparkles: :thumbsup: :sparkles:
api offline
Aminu Ibrahim Abubakar
@AminuSufi585
Sep 07 2017 12:12
You're welcome
Gokula Krishna
@AKX-X-32
Sep 07 2017 13:24
@Chrono79 thanks for the review
CamperBot
@camperbot
Sep 07 2017 13:24
akx-x-32 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
api offline
koder3
@koder3
Sep 07 2017 14:19
let data = [
    { avatar_url: 'wwww', name: 'dna', company: 'fb' },
    { avatar_url: 'wwwEw', name: 'dnEa', company: 'fEb' },
  ];
  let data2 = [
    { avatar_url: 'wdwww', name: 'dna', company: 'fdb' },
    { avatar_url: 'wwdwEw', name: 'dnEa', company: 'fEdb' },
  ];

function func(da) {
  return da

}
func(...data);
this is what i get { avatar_url: 'wwww', name: 'dna', company: 'fb' } why dont i get the full data array
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:21
@koder3
function func(...da) {
  return da

}
func(data);
koder3
@koder3
Sep 07 2017 14:22
@Lumexralph oh thanks. btw any idea why the method i used didnt work?
CamperBot
@camperbot
Sep 07 2017 14:22
koder3 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
api offline
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:27
@koder3 there's a way you use the rest/spread operator, in the parameters field it spreads the arguments into an array but when used in arguments it kind of spreads the elements in the array into the field and you know that, the first argument passed to a function gets called or used if there's just one parameter... for illustration , some mins pls
Kelechi Chinaka
@kelechy
Sep 07 2017 14:28
:wave: @Lumexralph
Aminu Ibrahim Abubakar
@AminuSufi585
Sep 07 2017 14:28
@camperbot What is api offline?
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:29
@koder3 try this see what you get
function func(da1, da2) {
  return [da1, da2];

}
func(...data);  // spreads the array out as arguments so it becomes  func({ avatar_url: 'wwww', name: 'dna', company: 'fb' },  { avatar_url: 'wwwEw', name: 'dnEa', company: 'fEb' })
@kelechy brotherly!
Kelechi Chinaka
@kelechy
Sep 07 2017 14:33
how your day going @Lumexralph
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:34
@koder3 so in summary, if spread/rest operator is used with parameter, it gathers the arguments into an array, if it's used with arguments in a function call, it spreads the element of the array out as arguments... that's the simple way I go about it personally
@kelechy been good, at work and feel like sleeping
@kelechy how're you?
Kelechi Chinaka
@kelechy
Sep 07 2017 14:34
:smile:
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:35
@kelechy ehn na
Kelechi Chinaka
@kelechy
Sep 07 2017 14:35
good, prepping lesson mat for my kids
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:35
@kelechy yeah, school resumption is close
Kelechi Chinaka
@kelechy
Sep 07 2017 14:35
u need am o, but u have to hold till u get home :smile:
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:36
@kelechy abi, and on getting home the sleep vanishes :disappointed:
Kelechi Chinaka
@kelechy
Sep 07 2017 14:36
sure...u know how e be, na
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:36
i sabi oo
going for lunch bro, be back soon
Kelechi Chinaka
@kelechy
Sep 07 2017 14:37
teaching kids is fun, but the treating from the school is low, i tend to sign out year ending
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:37
@kelechy for?
@kelechy go play small for Andela na
go and test your muscles
Kelechi Chinaka
@kelechy
Sep 07 2017 14:38
govt school maybe
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:38
govt school make sense but prompt payment nko?
Kelechi Chinaka
@kelechy
Sep 07 2017 14:38
sure i go tryout Andela @Lumexralph
koder3
@koder3
Sep 07 2017 14:39
@Lumexralph wow thanks so much!
CamperBot
@camperbot
Sep 07 2017 14:39
koder3 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
api offline
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:39
@kelechy i should go back and flex some muscles November God willing
Kelechi Chinaka
@kelechy
Sep 07 2017 14:39
the payment is cool via n-power scheme @Lumexralph
Morchid Chellali
@Morched23MJ
Sep 07 2017 14:39
Can someone tell me why the 'return' icon (fa-arrow-circle-left) is fadding like this? I did a line to hide it, when a game is finished. It's repeating the fading because there is a setInterval. Thank you in advance.
The pen: https://codepen.io/Morched23MJ/pen/VzRQZM?editors=1010
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:39
@koder3 you're welcome :smile:
Kelechi Chinaka
@kelechy
Sep 07 2017 14:40
so early? y nt jan @Lumexralph
am just not in a hurry to get in Andela, i dunno y? @Lumexralph
Ogundele Olumide
@Lumexralph
Sep 07 2017 14:41
@kelechy still have my leave left to be exhausted and to be honest I've made myself acquainted with technologies that threw me off. i'm pretty confident about.... it won't hurt a thing to try again
@kelechy take your time, once you're familiar with fullstack, go and try it out
i dey H......
Kelechi Chinaka
@kelechy
Sep 07 2017 14:44
sure i would @Lumexralph :+1:
go fill up :smile: @Lumexralph
imperial-isms
@imperial-isms
Sep 07 2017 15:19
getting an error message TypeError: json.forEach is not a function. (In 'json.forEach', 'json.forEach' is undefined) on this code…
$(document).ready(function() {

    $("#random-button").on("click", function(){
      $.getJSON("https://random-quote-generator.herokuapp.com/api/quotes/random", function(json) {
        var html = "";
////////////////////////////////////////////

        json.forEach(function (val) {

          var keys = Object.keys(val);
          html += "<id = 'quote-text'>";
          keys.forEach(function (val) {
            html += "<em>" + val[key] + "</em>" 
          }); 
        });

////////////////////////////////////////////
        $("#quote-text").html(html);
      });
    });

});
I can stringify the json variable/arguement and include it in the .html method, but something is getting hung up somewhere inside the purple slashes
JLuboff
@JLuboff
Sep 07 2017 15:20
@imperial-isms forEach is an array method. Your json property is a single object
imperial-isms
@imperial-isms
Sep 07 2017 15:20
I thought something like that was happening
Margaret Greaney
@greaneym
Sep 07 2017 15:20
Hi, I can see some people responding but it is just flashing up at the top and not echoing here to the gitter text stream, so I can't see it.
I think something is wrong here because I can't see responses. I will post some code to codepen.io and then ask again later.
imperial-isms
@imperial-isms
Sep 07 2017 15:22
Thanks @JLuboff …I just learned it from “Convert JSON Data to HTML”. I copied and pasted it (still analyzed it) from that lesson, so I had to figure that it would work.
CamperBot
@camperbot
Sep 07 2017 15:22
api offline
imperial-isms sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
horo
@wolfHoro
Sep 07 2017 15:22
'''
CamperBot
@camperbot
Sep 07 2017 15:22
:bulb: to format code use backticks! ``` more info
imperial-isms
@imperial-isms
Sep 07 2017 15:23
Why does this FCF code work…

<script>
  $(document).ready(function() {

    $("#getMessage").on("click", function() {
      $.getJSON("/json/cats.json", function(json) {

        var html = "";
        // Only change code below this line.
          json.forEach(function(val) {
            var keys = Object.keys(val);
            html += "<div class = 'cat'>";
            keys.forEach(function(key) {
              html += "<strong>" + key + "</strong>: " + val[key] + "<br>";
            });
            html += "</div><br>";
          });


        // Only change code above this line.

        $(".message").html(html);

      });
    });
  });
</script>
JLuboff
@JLuboff
Sep 07 2017 15:23
@imperial-isms No problem. It's always a good idea when working with api's to see the structure of the returned data. You can do so either by inside your Ajax call having a console.log(data) where data is your property name (in your case, it would be json). Or grab the url and put it into your browser and see what you get.
@imperial-isms I'd have to go verify, but I imagine that you get an array of objects back with that one
imperial-isms
@imperial-isms
Sep 07 2017 15:24
Okay that seems like the most likely scenario
horo
@wolfHoro
Sep 07 2017 15:24
function chunk(arr, size) {
  var i;
  var a=size;
  var m=Math.ceil(arr.length/size);
  var arrlength=arr.length;
  var litarr=new Array();
  var newarr=new Array();
  for (i=0;i<m;i++){
    newarr[i]=new Array(size);
    litarr=arr.slice(a-size,a);
    a=a+size;
    newarr[i].push(litarr);
  }

}

chunk(["a", "b", "c", "d"], 2);
Why isn't newarr a two-dimensional array?
imperial-isms
@imperial-isms
Sep 07 2017 15:24
I appreciate it
JLuboff
@JLuboff
Sep 07 2017 15:24
:+1:

@wolfHoro It's a multi-demsional array, but one too deep. Right now you have this

[ [ [ 'a', 'b' ] ], [ [ 'c', 'd' ] ] ]

If you return newarr

Inside your loop, you don't need newarr[i]=new Array(size); as litarr is an array
so then you just need to push litarr into newarr
horo
@wolfHoro
Sep 07 2017 15:29
@JLuboff Thank you,Let me think about it
CamperBot
@camperbot
Sep 07 2017 15:29
wolfhoro sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
api offline
horo
@wolfHoro
Sep 07 2017 15:35
function chunk(arr, size) {
  var i;
  var a=size;
  var m=Math.ceil(arr.length/size);
  var arrlength=arr.length;
  var litarr=new Array();
  var newarr=new Array();
  for (i=0;i<m;i++){
    litarr=arr.slice(a-size,a);
    a=a+size;
    newarr.push(litarr);
  }

}

chunk(["a", "b", "c", "d"], 2);
I deleted newarr[i], but newarr became [a, b, c, d]., which made me very frustrated
JLuboff
@JLuboff
Sep 07 2017 15:35
@wolfHoro return newarr outside your loop (before the last })
horo
@wolfHoro
Sep 07 2017 15:38
@JLuboff I was so stupid, I thought about it for too long, but I ignored the simple place. Thanks for reminding me
CamperBot
@camperbot
Sep 07 2017 15:38
wolfhoro sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
api offline
JLuboff
@JLuboff
Sep 07 2017 15:39
:+1:
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 15:39
@JLuboff why did you break camperbot cookie jar
Diego Mayer
@Chrono79
Sep 07 2017 15:40
He's on diet
and so we are
We'll starve if it doesn't get fixed soon
JLuboff
@JLuboff
Sep 07 2017 15:45
I'm missing my cookies :(
Blauelf
@Blauelf
Sep 07 2017 16:00
@JLuboff Maybe take one of those :cookie:
Michael Ney
@MichaelNey
Sep 07 2017 16:01
Hi, I am Using EJS, and an external JS file which is linked to the EJS page via script tag. however I'm getting a variable undefined error in the EJS when i'm trying to use one of the variables in the JS file. Is there a way I can make the JS file load before EJS javascript is executed? Since I think that may be the issue
JLuboff
@JLuboff
Sep 07 2017 16:03
@Blauelf It's just not the same sadly.. :cry:
Blauelf
@Blauelf
Sep 07 2017 16:11
Some :candy: then?
JLuboff
@JLuboff
Sep 07 2017 16:12
That'll have to suffice
Blauelf
@Blauelf
Sep 07 2017 16:16
Reminds me of Candy Box game.
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:16
@JLuboff lol me too. but idk what happen to camperbot's brownies.
Pethaf
@Pethaf
Sep 07 2017 16:22
:coffee:
:tea:
JLuboff
@JLuboff
Sep 07 2017 16:23
@Blauelf I don't have the patience for it, I want to keep eating them!
@RoniqueRicketts I'm wondering if since they're not really supporting gitter chat anymore that they killed the api..
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:24
@JLuboff really, so where will we chat?
:'(
JLuboff
@JLuboff
Sep 07 2017 16:25
The chat is still here, but perhaps no more brownies/cookies
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:25
So how will we know that we contribute everyday
JLuboff
@JLuboff
Sep 07 2017 16:25
....we wont!
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:27
NOOOOOO!!!
THey can't do that. Cant they??? :worried:
Krittiya Clark
@krittiyaclark
Sep 07 2017 16:28
Can anyone guid me how to build a Pomodoro Clock with api or plugin?
JLuboff
@JLuboff
Sep 07 2017 16:29
Who knows what sick twisted thoughts they may have
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:31
Well i hope the replacement will be even better
@krittiyaclark use Strickly Javascript to make a timer. No need for any 3rd party api. (My suggestion) All this can be done with raw javascript
Krittiya Clark
@krittiyaclark
Sep 07 2017 16:34
@RoniqueRicketts Strickly Javascript ?
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:36
@krittiyaclark yes3
JLuboff
@JLuboff
Sep 07 2017 16:37
Eh... personally I used a framework but I hated that project so meh
Krittiya Clark
@krittiyaclark
Sep 07 2017 16:38
@RoniqueRicketts Could not find it on google.
JLuboff
@JLuboff
Sep 07 2017 16:39
He meant use just regular Javascript, don't use a api or framework/library
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:42
yesd
Krittiya Clark
@krittiyaclark
Sep 07 2017 16:42
Oh okay!
Christopher McCormack
@cmccormack
Sep 07 2017 16:56
There are enough crazy frameworks that I thought Strickly might be one :joy:
Kelechi Chinaka
@kelechy
Sep 07 2017 16:57
:smile: thought so too
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:57
@cmccormack lol strickly is not a framework unless you wanna make it a framework
Kelechi Chinaka
@kelechy
Sep 07 2017 16:57
but nothing beat vanilla js
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:57
@kelechy true I love vanilla JS
Christopher McCormack
@cmccormack
Sep 07 2017 16:57
@RoniqueRicketts don't tempt me, I'll never get any real work done!
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 16:58
@cmccormack lol DO IT>>> :)
JLuboff
@JLuboff
Sep 07 2017 16:58
@cmccormack We all know you aren't getting any real work done anyhow
Christopher McCormack
@cmccormack
Sep 07 2017 16:59
I'm in meetings all day, do they count as work?
JLuboff
@JLuboff
Sep 07 2017 16:59
Nope.
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:00
@JLuboff lol don't show him up like that. Meeting is not real work @cmccormack
Christopher McCormack
@cmccormack
Sep 07 2017 17:00
Then don't tell my leadership - that's about all I do anymore :D
JLuboff
@JLuboff
Sep 07 2017 17:02
Lol
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:04
@cmccormack lol. smh. LUCKY BASTARD!
JLuboff
@JLuboff
Sep 07 2017 17:08
@RoniqueRicketts It looks like you're the lucky one, hurricane irma is staying clear of Jamaica?
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:09
@JLuboff lol I warned her not to come here. She knows that if she comes we plan to drunk her off with weed. :trollface:
JLuboff
@JLuboff
Sep 07 2017 17:09
:joy:
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:12
We got some heavy rains last-night but now the sun is out in all it glory.
weather.PNG
TWoerner94
@TWoerner94
Sep 07 2017 17:18
Hey guys, hope someone can help me with my lil problem i got here
Im working on the pomodoro clock and right now im just simply tring to get the stop button to work
I wanted to have start and stop as one button
Blauelf
@Blauelf
Sep 07 2017 17:18
@RoniqueRicketts Subtract 15 Kelvin from the temperature and that could be here.
TWoerner94
@TWoerner94
Sep 07 2017 17:19
Theres a boolean called clicked that returns true while a countdown is running
so my loop basically checks if a countdown is running, if not it works as a start button and triggers a setInterval
if clicked returns true then it should stop the interval from running
I tried to do that with clearInterval(countdown) but it doesnt seem to work
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:21
@Blauelf cool
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:34
I have some questions for nodejs/php developers. When you setting up an app from scratch lets say you buy a domain name and you also buy a serverspace. What do you do next to get coding building up the back-end so you can start serving pages? Anyone has any documentation for nodejs that I could read to get some info?
Christopher McCormack
@cmccormack
Sep 07 2017 17:34
@TWoerner94 probably a scoping issue, move var countdown outside your click handler so it's global
@TWoerner94 and don't forget to set clicked to false again in your else
TWoerner94
@TWoerner94
Sep 07 2017 17:37
Oh cool thanks I'll try that thanks @cmccormack
CamperBot
@camperbot
Sep 07 2017 17:37
twoerner94 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
TWoerner94
@TWoerner94
Sep 07 2017 17:39
How do i do that though? I want countdown to be triggered on click
Christopher McCormack
@cmccormack
Sep 07 2017 17:40
  var countdown
  //start stop button functionality
  $('#start').click(function() {
    if (!clicked) {
      clicked = true;
      let timer = len * 60;
      countdown = setInterval(function() {
        timer--;
        $('#remain').html(timer);
        if (timer === 0) {
          alarm.play();
          timer = brk * 60;
        }
      }, 1000);
    } else {
      clearInterval(countdown);
      clicked=false
    } 
  });
TWoerner94
@TWoerner94
Sep 07 2017 17:43
Ohh just declaring the name, not a value
That makes sense thanks again @cmccormack
Christopher McCormack
@cmccormack
Sep 07 2017 17:43
Right, sorry I wasn't more specific
CamperBot
@camperbot
Sep 07 2017 17:43
twoerner94 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
Christopher McCormack
@cmccormack
Sep 07 2017 17:43
np
TWoerner94
@TWoerner94
Sep 07 2017 17:45
Worked perfectly :D
I was under the impression that var would be hoisted up to a higher level anyways
But maybe i just misunderstand hoisting
JLuboff
@JLuboff
Sep 07 2017 17:51
@RoniqueRicketts I haven't looked too much into it myself, but you would need to purchase serverspace as opposed to web server space since with node you're creating the web server. I'm not entirely sure how that works since I've only used free hosts at this point (heroku and glitch)
Christopher McCormack
@cmccormack
Sep 07 2017 17:52
@TWoerner94 it will hoist to the top of the scope, but I believe the scope is your callback function, and when you click it again you're calling it with a new callback function
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:54
@JLuboff even that i've never uset it before can i do it :)
JLuboff
@JLuboff
Sep 07 2017 17:55
@RoniqueRicketts I normally build up everything locally, and while doing so constantly (atleast once a day if not multiple times a day) push my code up to github. When I'm ready to deploy, I deploy from my github repo to either heroku or glitch
Christopher McCormack
@cmccormack
Sep 07 2017 17:55
For my server I'm using godaddy, for my url I'm using Hover. Godaddy gives you a full unix interface to install what you need to do the backend stuff
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:56
I wanna mess around with an application concept I have
@cmccormack So I just install node then I can install packages with npm?
JLuboff
@JLuboff
Sep 07 2017 17:57
@RoniqueRicketts I would just do it locally then, no reason not to
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 17:57
@JLuboff I wanna know how to use a server
JLuboff
@JLuboff
Sep 07 2017 17:58
Thats the thing...with node, you're creating the server. Setting it up is roughly the same when doing it locally on your machine or doing it on a remote machine (only difference might be installing node as its going to be sliughtly different between windows/mac/linux)
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:05
@JLuboff OMG YOUR JOKING RIGHT!!!!?????
JLuboff
@JLuboff
Sep 07 2017 18:06
I mean, there might be a few extra steps for a true production environment but ya its not like setting up a windows web server with cpanel or what not
Christopher McCormack
@cmccormack
Sep 07 2017 18:08
@RoniqueRicketts dang you now I'm digging into AWS services for hosting and I bet I'm going to end up spending :moneybag: today...
Beanstalk appears to have a preconfigured node.js platform which may be nice
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:09
@cmccormack not my fault
Christopher McCormack
@cmccormack
Sep 07 2017 18:10
@RoniqueRicketts little bit your fault :)
I agree with @JLuboff though, set it up locally, a server is just a computer. If you want to try it with unix/linux, install a virtual machine
Gersho
@Gersho
Sep 07 2017 18:12
wait what ? shouldn't you always use a VM for hosting ?
Christopher McCormack
@cmccormack
Sep 07 2017 18:12
Your question is too general @Gersho
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:12
@cmccormack nice I can install nodejs and also set up the scripts for a server
Gersho
@Gersho
Sep 07 2017 18:13
@cmccormack i meant, that no matter what OS you use, you should have your whatever server in a VM, not your main system
expect if it's a system you don't use ofc
Christopher McCormack
@cmccormack
Sep 07 2017 18:14
I'm not certain why you would think that - maybe it's a good practice for ensuring your environment is clean and replicatable but for just playing with a node server you can run it on the local OS if you like I imagine.
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:17
@JLuboff so lets say I go on heruku and sign up should i just select a random server and then make it work.
Gersho
@Gersho
Sep 07 2017 18:17
oh yeah if it's only for tests there's no problem (oh and on top of being clean/replicable, it also limits the posibility of rights elevation in case the vm is compromised)
JLuboff
@JLuboff
Sep 07 2017 18:20
@RoniqueRicketts Heroku does not have an editor (as far as I know), so you need to develop locally. Glitch does have an editor, so you may want to try that out
Speaking of VM's...I just built one 20 minutes ago heh
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:23
@JLuboff thanks man. I wanna try out some things i know ;) I got some apps I might try to develelop
CamperBot
@camperbot
Sep 07 2017 18:23
roniquericketts sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2185 | @jluboff |http://www.freecodecamp.com/jluboff
JLuboff
@JLuboff
Sep 07 2017 18:24
!!!!!!
Stephen James
@sjames1958gm
Sep 07 2017 18:24
@RoniqueRicketts Heroku will pull information from github to launch an application.
JLuboff
@JLuboff
Sep 07 2017 18:24
The API is back!
Stephen James
@sjames1958gm
Sep 07 2017 18:24
@RoniqueRicketts The integration is pretty good.
JLuboff
@JLuboff
Sep 07 2017 18:25
@sjames1958gm Its funny. I keep switching between heroku and glitch. I've had a couple times where I deploy an app to Heroku and it just won't build properly for some reason (usual a crash that I can't figure out) but then I go and deploy to Glitch with out an issue
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:25
wait I gave back the brownies. your have to know how to say thanks
Stephen James
@sjames1958gm
Sep 07 2017 18:25
@JLuboff Hmm. I have not tried glitch.
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:26
@sjames1958gm so ill have to push to github first before I can push it to heroku
JLuboff
@JLuboff
Sep 07 2017 18:26
@sjames1958gm Glitch is a little..goofy... but it works
@RoniqueRicketts Yes, that or your can use the heroku CLI and push it that way, but I find the github method easier
Christopher McCormack
@cmccormack
Sep 07 2017 18:27
@sjames1958gm @JLuboff @RoniqueRicketts thanks
CamperBot
@camperbot
Sep 07 2017 18:27
cmccormack sends brownie points to @sjames1958gm and @jluboff and @roniquericketts :sparkles: :thumbsup: :sparkles:
:cookie: 386 | @roniquericketts |http://www.freecodecamp.com/roniquericketts
:star2: 2186 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 8446 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Sep 07 2017 18:27
@cmccormack thx
CamperBot
@camperbot
Sep 07 2017 18:27
sjames1958gm sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1193 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Sep 07 2017 18:27
;D
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:27
see i brought back brownies :)
Christopher McCormack
@cmccormack
Sep 07 2017 18:27
Nice job
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:27
hehehe
JLuboff
@JLuboff
Sep 07 2017 18:28
@cmccormack Thanks for being the hero we always wanted, Parameter Man!
CamperBot
@camperbot
Sep 07 2017 18:28
jluboff sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1194 | @cmccormack |http://www.freecodecamp.com/cmccormack
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:29
lol smh ya'll crazy
Stephen James
@sjames1958gm
Sep 07 2017 18:31
@RoniqueRicketts How'd the weather down there - are you in the path of Irma?
JLuboff
@JLuboff
Sep 07 2017 18:32
@sjames1958gm speaking of hurricanes...were you any where near the other one (apparently I forgot the name already)
Stephen James
@sjames1958gm
Sep 07 2017 18:33
@JLuboff Harvey
Christopher McCormack
@cmccormack
Sep 07 2017 18:33
@JLuboff haha
Gersho
@Gersho
Sep 07 2017 18:33
irma
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:33
@sjames1958gm sunny for me. as we speak
Gersho
@Gersho
Sep 07 2017 18:33
?
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:33
weather.PNG
JLuboff
@JLuboff
Sep 07 2017 18:33
Yes...Harvey. Were you near Harvery?
Gersho
@Gersho
Sep 07 2017 18:33
also there's jose next week
Stephen James
@sjames1958gm
Sep 07 2017 18:33
@JLuboff I live in N. Texas which is about 300 miles from Houston
JLuboff
@JLuboff
Sep 07 2017 18:34
Ah. Gotcha. I just knew you were in Texas
Stephen James
@sjames1958gm
Sep 07 2017 18:34
Texas is a big state
@RoniqueRicketts lol the weather app pays off
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:35
@sjames1958gm Yes I am happy to use it :)
Gersho
@Gersho
Sep 07 2017 18:37
well you're far from irma and jose's path you shouldn't have any trouble
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:38
I have to go out in the sun in the next 30m for lunch and I really don't wanna endure all that heat
Gersho
@Gersho
Sep 07 2017 18:39
haha good luck with that, i tend to avoid the sun at such hours (Guadeloupe here)
JLuboff
@JLuboff
Sep 07 2017 18:40
I just hang out in my office during lunch
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 18:40
@Gersho Dang man. Ill drop you guys a pic of what outside looks like when I am back.
Christopher McCormack
@cmccormack
Sep 07 2017 18:52
@JLuboff Playing with Amazon beanstalk - pretty simple to deploy a node js site for free - http://mackville.us-west-2.elasticbeanstalk.com/
ignore the terrible formatting I didn't include css or anything yet, just wanted to test a push
JLuboff
@JLuboff
Sep 07 2017 18:58
Did you have to setup the packages and everything or no?
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:00
image.png
how would you guys achieve this using a float on the icon or?
im using flex to divide it in 4
but inside of each div how would you do it?
Christopher McCormack
@cmccormack
Sep 07 2017 19:02
@JLuboff I just downloaded the package template, modified and uploaded next version
JLuboff
@JLuboff
Sep 07 2017 19:02
Ah
korzo
@korzo
Sep 07 2017 19:02
@tiagocorreiaalmeida You can also use display: inline-block or display: table
Gersho
@Gersho
Sep 07 2017 19:03
display:inline , position:fixed and a z index so it stays on top ? @tiagocorreiaalmeida
Christopher McCormack
@cmccormack
Sep 07 2017 19:03
Apparently I know nothing about node though - for some reason my files aren't loading and my css file has the same data as my index file :D
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:03
seems I wanst clear
image.png
in terms of html css how would you do this part
JLuboff
@JLuboff
Sep 07 2017 19:04
@cmccormack :joy: Do you have it in a repo or everything lives on your beanstalk?
Gersho
@Gersho
Sep 07 2017 19:04
@tiagocorreiaalmeida 2 colums, one with the icon, the other with the text centered left ?
Christopher McCormack
@cmccormack
Sep 07 2017 19:04
I'm basically copying my old portfolio files into the template I downloaded, zipping it, then uploading. I"m guessing I need to do something to load css files and images from my app.js
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:04
was thinking about it
seems the only idea
Gersho
@Gersho
Sep 07 2017 19:05
or wwith span, but i prefer the col version
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:05
im doing it without bootstrap so all manually
there is a thing called grid o nss right?
css*
Gersho
@Gersho
Sep 07 2017 19:05
<i></i><span>548 </br> projects completed </span> would that work ?
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:06
its breaking the entire flex no idea why xd
anyway avoid br is a good thing
JLuboff
@JLuboff
Sep 07 2017 19:06
@cmccormack If the files reside in a seperate folder from app.js then just make sure your path is correct in your html file './public/css/style.css'
Christopher McCormack
@cmccormack
Sep 07 2017 19:07
@JLuboff I know that :)
I moved it all into the root dir and still nogo
korzo
@korzo
Sep 07 2017 19:07
@tiagocorreiaalmeida div>(div>i) + div>span*2
and use display: table-cell. Then you can center vertically
Gersho
@Gersho
Sep 07 2017 19:07
but i think you'd better use row/col, or you could go for position relative (to parent element)
mstellaluna
@mstellaluna
Sep 07 2017 19:08
@texas2010 thanks
CamperBot
@camperbot
Sep 07 2017 19:08
mstellaluna sends brownie points to @texas2010 :sparkles: :thumbsup: :sparkles:
api offline
Gersho
@Gersho
Sep 07 2017 19:08
oh it broke again :'(
Margaret Greaney
@greaneym
Sep 07 2017 19:12
Hello, I need some help on the react camp leaderboard please. I have a functioning app but it needs more work on the styling, plus I don't know how to fix the img src= problem in react. Here is my pen so far,https://codepen.io/greaney/pen/gxNwEL
BrianWilliams28
@BrianWilliams28
Sep 07 2017 19:13
Can someone who's completed the steamroller algorithm provide a hint on what they did to solve the problem?
Margaret Greaney
@greaneym
Sep 07 2017 19:14
How do I use ReactDOM on the json file for the image assoc. with username? I have tried just the https and then this way with img src= and can't understand what to do to fix. Thanks.
May Kittens Devour Your Soul
@diomed
Sep 07 2017 19:15
why is there a caret before every number value?
"vue": "^2.3.3",
Gersho
@Gersho
Sep 07 2017 19:17
@greaneym <image> is non standard, prefer <img>
from the doc
<image>

In This Article
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Summary

The HTML <image> element was an experimental element designed to display pictures. It never was implemented and the standard <img> element must be used.

Do not use this! In order to display images, use the standard <img> element.
JLuboff
@JLuboff
Sep 07 2017 19:18
@cmccormack I guess you're just SOL... ;)
Margaret Greaney
@greaneym
Sep 07 2017 19:18
@Gersho , thanks will try that. If I don't use img src=, how come it can resolve just the http string?
CamperBot
@camperbot
Sep 07 2017 19:18
greaneym sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 402 | @gersho |http://www.freecodecamp.com/gersho
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:19
@korzo for what I know display table
is not that friendly of web right?
Stephen James
@sjames1958gm
Sep 07 2017 19:20
@BrianWilliams28 Used recursion to flatten inner arrays.
BrianWilliams28
@BrianWilliams28
Sep 07 2017 19:21
@sjames1958gm i don't know how to use recursion to do that
Stephen James
@sjames1958gm
Sep 07 2017 19:21
@diomed
In the simplest terms, the tilde matches the most recent minor version (the middle number). ~1.2.3 will match all 1.2.x versions but will miss 1.3.0.

The caret, on the other hand, is more relaxed. It will match the most recent major version (the first number). ^1.2.3 will match any 1.x.x release including 1.3.0, but will hold off on 2.0.0.
Christopher McCormack
@cmccormack
Sep 07 2017 19:21
@JLuboff do you have to do something in the app.js file to add images and css? app.js appears to be the node server
May Kittens Devour Your Soul
@diomed
Sep 07 2017 19:22
thanks @sjames1958gm
CamperBot
@camperbot
Sep 07 2017 19:22
diomed sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8447 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Sep 07 2017 19:22
@BrianWilliams28 You could loop through the array replacing any inner array with the contents of the array
Then loop over that until there are no inner arrays
Margaret Greaney
@greaneym
Sep 07 2017 19:22
I changed the word image to the standard "img" but it still does not render correctly. React may render this differently?
Gersho
@Gersho
Sep 07 2017 19:22
i'm still starting in react so i wouldn't know ^^
Margaret Greaney
@greaneym
Sep 07 2017 19:23
@Gersho, thanks for your help, though
CamperBot
@camperbot
Sep 07 2017 19:23
greaneym sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
api offline
Christopher McCormack
@cmccormack
Sep 07 2017 19:23
@greaneym why not use JSX? so much easier to work with
JLuboff
@JLuboff
Sep 07 2017 19:23
@cmccormack No...you shouldn't have to unless you want a page served automatically (which isn't the case). Did you check Dev tools?
Margaret Greaney
@greaneym
Sep 07 2017 19:23
@cmccormack , I would but how do you use sass with inline styles?
May Kittens Devour Your Soul
@diomed
Sep 07 2017 19:23
@sjames1958gm can python mix with other programming languages? like , can it be embedded into them
Christopher McCormack
@cmccormack
Sep 07 2017 19:24
@greaneym you can just use classes
you don't have to use inline styles for everything
Margaret Greaney
@greaneym
Sep 07 2017 19:24
So far I can either use style={} with jsx, or not use jsx and use className=.
Stephen James
@sjames1958gm
Sep 07 2017 19:24
@greaneym store the json into your component state - then use jsx in your render() function - don't try building HTML like you are doing.
Margaret Greaney
@greaneym
Sep 07 2017 19:24
I haven't found any good examples of that yet, any pointers/
Gersho
@Gersho
Sep 07 2017 19:25
oh by the way i have a question about classes, i can't seem to get the difference between a constructor function and a class, so what's the deal ?
Christopher McCormack
@cmccormack
Sep 07 2017 19:25
<div className='someclass'>{stuff}</div>
Stephen James
@sjames1958gm
Sep 07 2017 19:25
@diomed There are libraries that let you call python from inside of say a c++ program. But, not sure that is what you are asking.
Christopher McCormack
@cmccormack
Sep 07 2017 19:25
@JLuboff well some of the css loaded...
Margaret Greaney
@greaneym
Sep 07 2017 19:25
@sjames1958gm , thanks I will look at how to do that. But I was kind of surprised to find you could use classNames with ReactDom.
CamperBot
@camperbot
Sep 07 2017 19:25
greaneym sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8448 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
JLuboff
@JLuboff
Sep 07 2017 19:26
@cmccormack ...thats a start..
Stephen James
@sjames1958gm
Sep 07 2017 19:26
@greaneym className is used inside of jsx because class is a reserved word in js
Christopher McCormack
@cmccormack
Sep 07 2017 19:26
@JLuboff but only after I added this in my node config css = fs.readFileSync('portfolio.css'); andres.write(css);` later on
errors now :)
JLuboff
@JLuboff
Sep 07 2017 19:27
huh.. wierd. I'm guessing its using vanilla node and not express? I develop with express which makes things easier but I don't know that that would affect those files
Christopher McCormack
@cmccormack
Sep 07 2017 19:27
@greaneym you should try using react components and only use react dom to attach your app to the Dom
Margaret Greaney
@greaneym
Sep 07 2017 19:28
@cmccormack , I've seen the example where the reactDOM is used in the index.js to render the app, and everything else is in App.js or whatever.js. So follow this example, you are saying.
Christopher McCormack
@cmccormack
Sep 07 2017 19:29
I think personally it's much cleaner
Margaret Greaney
@greaneym
Sep 07 2017 19:29
@cmccormack , I am a react newbie. thanks
CamperBot
@camperbot
Sep 07 2017 19:29
greaneym sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1195 | @cmccormack |http://www.freecodecamp.com/cmccormack
Gersho
@Gersho
Sep 07 2017 19:30

I've seen the example where the reactDOM is used in the index.js to render the app, and everything else is in App.js or whatever.js. So follow this example, you are saying.

oh, that's the part i was reading yesterday, codeacademy \o/

Christopher McCormack
@cmccormack
Sep 07 2017 19:30
@greaneym here's an example I made, similar to the markdown viewer - https://codepen.io/cmccormack/pen/rwqLyr
@greaneym but if I remade it now I would probably use more functional components
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 19:31
Hey guys i'm back
IMG_20170907_134246.jpg
IMG_20170907_134254.jpg
Margaret Greaney
@greaneym
Sep 07 2017 19:31
is it ok to look at this? I haven't been looking at people's codepens. But I need to get clearer examples , so I will look. Hope that is all right.
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 19:31
This is what outside looks like right not in Jamaica
Christopher McCormack
@cmccormack
Sep 07 2017 19:32
@greaneym that's why I shared it :) it's not one of the actual FCC projects, just something I made to help me parse some documents for work
Gersho
@Gersho
Sep 07 2017 19:32
@greaneym it's ok to look at everything, as long as you don't copy stuff you don't understand
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:32
image.png
what would be the best way to center the text with the icon right now?
Christopher McCormack
@cmccormack
Sep 07 2017 19:33
@greaneym and I hate to be that guy but... their documentation is really great https://facebook.github.io/react/docs/hello-world.html
Tiago Correia
@tiagocorreiaalmeida
Sep 07 2017 19:33
used display inline on the divs
Margaret Greaney
@greaneym
Sep 07 2017 19:33
@cmccormack @Gersho , thanks for helping I will learn some more
CamperBot
@camperbot
Sep 07 2017 19:33
greaneym sends brownie points to @cmccormack and @gersho :sparkles: :thumbsup: :sparkles:
api offline
api offline
Christopher McCormack
@cmccormack
Sep 07 2017 19:34
@greaneym they use React themselves, eating their own dogfood as they say, so they're the best resource for best practices
Gersho
@Gersho
Sep 07 2017 19:35
aren't they the ones who made it anyway ?
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 19:35
lol api is offline unless I use it :)
Margaret Greaney
@greaneym
Sep 07 2017 19:36
I am signing off now to look at more examples. thanks and bye.
Christopher McCormack
@cmccormack
Sep 07 2017 19:36
@Gersho yup thus the eating their own dogfood :)
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 19:36
@greaneym later Margs
Christopher McCormack
@cmccormack
Sep 07 2017 19:36
@greaneym gl :thumbsup:
njordomir
@njordomir
Sep 07 2017 20:46

Quick question: if I pass the following array into the function njordsFunction(args):

([1, 2, 3], [5, 2, 1, 4])

How can I reference the first and second arrays? I've been doing this for a few months now, so I feel stupid asking it, but when I do args[0] and args[1], I just get 1 and 2 the first two elements in the first array.

korzo
@korzo
Sep 07 2017 20:48
@njordomir arguments[0], arguments[1]
njordomir
@njordomir
Sep 07 2017 20:54
@korzo Somtimes it's the dumbest mistakes that stump us the most. Thanks!
CamperBot
@camperbot
Sep 07 2017 20:54
:cookie: 459 | @korzo |http://www.freecodecamp.com/korzo
njordomir sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
Randell Dawson
@randelldawson
Sep 07 2017 21:31

@njordomir - will the function only expect to see two arguments? If so, then declare the function as:

function njordsFunction(arg1, arg2) {

then you can use arg1 and arg2 variables

Sue
@coding-sue-true
Sep 07 2017 22:00
is there anyone?
Ronique Ricketts
@RoniqueRicketts
Sep 07 2017 22:00
sup
Sue
@coding-sue-true
Sep 07 2017 22:00
I am using bootstrap 4, and I want to open a modal only when the button is clicked and not onload
I went to bootstrap modal methods and I copied the code, but it always opens onload.. does anyone knows how to change this only to open onclick?
I want to use JS methods and not data-*
Gersho
@Gersho
Sep 07 2017 22:15
i don't know the specifics, but you could have some code hide it, and then make it reappear onclick ? @coding-sue-true
legendinraze
@legendinraze
Sep 07 2017 22:42
var myStr = "backslash\\ tab\t tab\t carriage-return\r new-line\n"; // Change this line
what's wrong
Coy Sanders
@coymeetsworld
Sep 07 2017 22:47
dont use the words
use the escape characters to the right of the words in the table @legendinraze . You're basically doing a search and replace
e.g. replace tab with \t
Simon Cordova
@gbsimon87
Sep 07 2017 22:52
Anybody from London looking for a developing job?
@coding-sue-true, still need help?
legendinraze
@legendinraze
Sep 07 2017 23:12
thx @coymeetsworld
Coy Sanders
@coymeetsworld
Sep 07 2017 23:13
no problem
juni
@junipberry
Sep 07 2017 23:13
guys, when does one use the arrow, =>
is it a shorthand for something
korzo
@korzo
Sep 07 2017 23:17
@junipberry it's arrow function
new in ES6
juni
@junipberry
Sep 07 2017 23:18
yes, but what does it do?
JLuboff
@JLuboff
Sep 07 2017 23:18
Its a shorthand method for functions
korzo
@korzo
Sep 07 2017 23:18
@junipberry It's more-less shortcut for old function syntax with few exceptions
JLuboff
@JLuboff
Sep 07 2017 23:19
It essentially eleminates the need for the word function
korzo
@korzo
Sep 07 2017 23:21
@JLuboff I would not say eliminates. There are cases when old syntax is beneficial
Manish Giri
@Manish-Giri
Sep 07 2017 23:22
@JLuboff :wave:
JLuboff
@JLuboff
Sep 07 2017 23:22
@korzo Correct, in the cases where you use it, thats basically what it does is gets rid of function
@Manish-Giri Manish my firend, how are you?
Manish Giri
@Manish-Giri
Sep 07 2017 23:22
@JLuboff recovering from the flu
ugh
JLuboff
@JLuboff
Sep 07 2017 23:22
That sucks
Manish Giri
@Manish-Giri
Sep 07 2017 23:22
how're you
JLuboff
@JLuboff
Sep 07 2017 23:23
Not bad...just waiting for the day to be over
Manish Giri
@Manish-Giri
Sep 07 2017 23:23
yea
nice
ooh maybe you can help me with my question @JLuboff
JLuboff
@JLuboff
Sep 07 2017 23:23
Half-assly working on my Book (game) trading app
Perhaps I can..
Manish Giri
@Manish-Giri
Sep 07 2017 23:24
@JLuboff so I have an input string, and I need to make sure it passes some criteria, like it should have at least one character, should have both letters & numbers, shouldn't have _, etc.
JLuboff
@JLuboff
Sep 07 2017 23:24
Alright..so form validation?
Manish Giri
@Manish-Giri
Sep 07 2017 23:25
but the problem is, I don't know of a way to do something like ! in regex, you know?
like with regular loops, you could do - if (element !== '\s')
JLuboff
@JLuboff
Sep 07 2017 23:25
How are you testing?
Manish Giri
@Manish-Giri
Sep 07 2017 23:25
but if you do /\S/, it matches a whole world of other characters that aren't whitespaces
it's for a codewars kata, lol
JLuboff
@JLuboff
Sep 07 2017 23:26
You could always do if(!string.test(regex))
Oh gotcha
Manish Giri
@Manish-Giri
Sep 07 2017 23:26
right but then I'd need multiple regexes?
if(string.test(r1) && !string.test(r2))
JLuboff
@JLuboff
Sep 07 2017 23:27
Hmmm..possibly..
Manish Giri
@Manish-Giri
Sep 07 2017 23:29
Screenshot 2017-09-07 19.29.34.png
@JLuboff that looks like it works, but I can't think coz of the flu, ugh
@JLuboff ty
CamperBot
@camperbot
Sep 07 2017 23:30
manish-giri sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2187 | @jluboff |http://www.freecodecamp.com/jluboff
JLuboff
@JLuboff
Sep 07 2017 23:30
my syntax was wrong... should be regex.test(string)
Manish Giri
@Manish-Giri
Sep 07 2017 23:34
worked
JLuboff
@JLuboff
Sep 07 2017 23:34
:+1:
Manish Giri
@Manish-Giri
Sep 07 2017 23:34
Screenshot 2017-09-07 19.34.37.png
JLuboff
@JLuboff
Sep 07 2017 23:35
const alphanumeric = s => { /[A-Za-z\d]+/.test(s) && !/[\s*_!]/.test(s)
Manish Giri
@Manish-Giri
Sep 07 2017 23:36
damn ppl have solved it with just one .test
JLuboff
@JLuboff
Sep 07 2017 23:37
I believe it. My regex aint that strong though so I wouldn't be able to
Manish Giri
@Manish-Giri
Sep 07 2017 23:37
s => /^[a-z\d]+$/i.test(s);
so this
Andrew Kay
@andrewjkay
Sep 07 2017 23:38
Does anyone know of a way to get around a No 'Access-Control-Allow-Origin' header is present error? Trying to query an API from vanilla JS, don't want to have to use jquery or implement a back end
JLuboff
@JLuboff
Sep 07 2017 23:38
@Manish-Giri Ya I'd have to look all that up to see what it does lol
Manish Giri
@Manish-Giri
Sep 07 2017 23:39
I think this bit - ^[a-z\d]+ - matches start of the input
and this matches the end - [a-z\d]+$
since it doesn't leave scope for anything else in between
maybe that's why it passes?
@JLuboff
JLuboff
@JLuboff
Sep 07 2017 23:41
...sure!
Addison
@addisonday
Sep 07 2017 23:54

More Regex help!! XD.

I am not sure why this matches the last test. It passes all the others. I thought the syntax {num1, num2} matched a range? Is it a bug? Here is my regex:

let ohStr = "Ohhh no";
let ohRegex = /h{3,6}/;
let result = ohRegex.test(ohStr);

\*Your regex should use curly brackets.
Your regex should not match "Ohh no"
Your regex should match "Ohhh no"
Your regex should match "Ohhhh no"
Your regex should match "Ohhhhh no"
Your regex should match "Ohhhhhh no"
Your regex should not match "Ohhhhhhh no"*/
Nick Cleary
@Hijerboa
Sep 07 2017 23:55
question: is there a more efficient way to determine if a number is a prime than through a for loop?
Manish Giri
@Manish-Giri
Sep 07 2017 23:59
@addisonday link to challenge?