These are chat archives for FreeCodeCamp/HelpFrontEnd

27th
Mar 2018
Austin Jess
@ajess33
Mar 27 2018 01:15
I’m trying to add a node_modules folder to my .gitignore file and I put ‘node_modules/‘ in there and that seemed to untrack some but most are still being tracked
Any ideas why??
Brad
@bradtaniguchi
Mar 27 2018 01:25
@ajess33 Did you already make a commit with the node_modules, so it was previously tracked?
Since its node_modules, you can delete it. (this should show up in .gitignore) and commit the deletion, it shouldn't be tracked after. Then after, run npm install again to get the packages back.
Loralie Flint
@laflint92
Mar 27 2018 01:42
i cant get my javascript to work anyone willing to help me?
Lisa Copeland
@lisacopeland
Mar 27 2018 01:44
@laflint92 I could take a stab - what's up?
Loralie Flint
@laflint92
Mar 27 2018 01:44

$(document).ready(function(){

if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position){
$("#geoLoc").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);

  var lat = position.coords.latitude;
  var long = position.coords.longitude;
  var api = "http://fcc-weather-api.glitch.me/api/current?"; 

  $.getJSON(api).done(function(data){
 console.log(lat, long);
});
  });

}
});

Lisa Copeland
@lisacopeland
Mar 27 2018 01:44
What's going wrong?
Loralie Flint
@laflint92
Mar 27 2018 01:44
i have no idea where i went wrong it says lat and long are not defined
no matter where i define them
Lisa Copeland
@lisacopeland
Mar 27 2018 01:45
(sorry - I haven't done much jquery) don't you have to define your vars within document ready?
Loralie Flint
@laflint92
Mar 27 2018 01:46
thats what i thought but it stills says the same thing
Lisa Copeland
@lisacopeland
Mar 27 2018 01:47
I am seeing that you need to do something like var myVar; jQuery (function() { //more code and refer to myVar })
have you tried that?
Loralie Flint
@laflint92
Mar 27 2018 01:48
no i havent
Lisa Copeland
@lisacopeland
Mar 27 2018 01:48
or set the variable as a property of the window object - window.myVar = $(this).attr('myVar');
Why don't you see if either of those help
Loralie Flint
@laflint92
Mar 27 2018 01:49
im not to familiar with the second one ill try the first method
Brad
@bradtaniguchi
Mar 27 2018 01:50
@laflint92 Wait how does the getJSON work?
looks to me like your not passing it to the api request
Loralie Flint
@laflint92
Mar 27 2018 01:51
how exactly do i do that im just learning if you could show me that would be awesome @bradtaniguchi
Brad
@bradtaniguchi
Mar 27 2018 01:52
@laflint92 Look at the example they provide on their api page:
they pass the lat and long in the url
Loralie Flint
@laflint92
Mar 27 2018 01:57
so more like this?
@bradtaniguchi
Brad
@bradtaniguchi
Mar 27 2018 02:00
yea that looks right, I don't think you need the appid tho
@laflint92
Loralie Flint
@laflint92
Mar 27 2018 02:00
oh ok let me try
ReferenceError: lat is not defined[Learn More]
Brad
@bradtaniguchi
Mar 27 2018 02:04
@laflint92 hmm, can you post your code again? (I might go afk might take me a while to respond)
Brad
@bradtaniguchi
Mar 27 2018 02:08
@laflint92 I got a different error about mixed content
But, this can be fixed by changing your url to https instead of http
since the glitch api is served over https, you need to change it
Loralie Flint
@laflint92
Mar 27 2018 02:10
i changed it and its the same thing this has been driving me nuts im new but ive been racking my brain so hard trying to find the problem
Brad
@bradtaniguchi
Mar 27 2018 02:10
Your getting lat not defined?
@laflint92 here's my fork, it has basically no change and is working on my end
oops
going afk now
Loralie Flint
@laflint92
Mar 27 2018 02:13
yeah its the same even when i ipen ur link
could it be because im on linux?
Aditya
@ezioda004
Mar 27 2018 02:16
@laflint92 Try different browser? Maybe you have popups blocked in yours
Loralie Flint
@laflint92
Mar 27 2018 02:18
i do have pop ups blocked should i allow them
Stephen James
@sjames1958gm
Mar 27 2018 02:18
@laflint92 It wasn't working for me then suddenly it started working??
Loralie Flint
@laflint92
Mar 27 2018 02:19
hmm ok
Stephen James
@sjames1958gm
Mar 27 2018 02:19
@laflint92 Maybe try pasting the URL into your browser address bar and see if you get json?
https://fcc-weather-api.glitch.me/api/current?lat=0&lon=0
Or just click the link above
Loralie Flint
@laflint92
Mar 27 2018 02:21
the link works :(
im so lost i wish i had more expierence
JoEezy
@JoEeeezy_twitter
Mar 27 2018 02:54
works here too
JoEezy
@JoEeeezy_twitter
Mar 27 2018 03:04
@laflint92 try this
var api = "https://fcc-weather-api.glitch.me/api/current?lat=0&lon=0";
var lat; 
var long;

$(document).ready(function(){  
  if (navigator.geolocation){
    navigator.geolocation.getCurrentPosition(function(position){
      $("#geoLoc").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);
     var lat = position.coords.latitude;
      var long = position.coords.longitude;
      var url = api + lat + "&" + long;

      $.getJSON(url, function(data){
     console.log(data["main"]["temp"]);
    });
      });
  }
});
abraham anak agung
@padunk
Mar 27 2018 03:22
@laflint92 var api should be var api = "https://fcc-weather-api.glitch.me/api/current?" and
var url = api + "lat=" lat + "&lon=" long;
Abhi Indoria
@AIndoria
Mar 27 2018 04:07
Does anyone know how I would go on around placing that about text field under the first two flexbox items? https://repl.it/@AIndoria/DoubleCoarseBrowsers
here's how it looks full screen: https://doublecoarsebrowsers--aindoria.repl.co/
Abhi Indoria
@AIndoria
Mar 27 2018 05:02
(fixed it)
just had to put main div in direction:column and the first one in row.
Mandeep
@mandeephub
Mar 27 2018 05:24
hello to all
Markus Kiili
@Masd925
Mar 27 2018 05:24
@mandeephub Hello.
Dhaval Vira
@dhavalveera
Mar 27 2018 05:24
hello Mandeep
Mandeep
@mandeephub
Mar 27 2018 05:25
i m stucked in a code challenge pls help
Dhaval Vira
@dhavalveera
Mar 27 2018 05:25
in which Language?
Mandeep
@mandeephub
Mar 27 2018 05:25
javascript
Markus Kiili
@Masd925
Mar 27 2018 05:28
@mandeephub Post the challenge name and try to explain the problem. Post relevant code also.
Mandeep
@mandeephub
Mar 27 2018 05:29
challenge is cleared but i got stucked insomwhere else
here is the link @Masd925 https://jsbin.com/buwusokaco/edit?js,console
Pls have a look
coderNewby
@coderNewby
Mar 27 2018 05:30
@DarrenfJ have Pm thanks for the help
CamperBot
@camperbot
Mar 27 2018 05:30
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2439 | @darrenfj |http://www.freecodecamp.org/darrenfj
Markus Kiili
@Masd925
Mar 27 2018 05:30
@mandeephub You need to return instead of console.log so the function execution stops.
Also return num * factorialize(num-1);
Mandeep
@mandeephub
Mar 27 2018 05:32
@Masd925 ok and what if i want to print that on my html page
Markus Kiili
@Masd925
Mar 27 2018 05:34
@mandeephub You can use the function you wrote for that. myElem.textContent(factorialize(5)) or something like that.
Mandeep
@mandeephub
Mar 27 2018 05:35
ok thanks bro @Masd925
CamperBot
@camperbot
Mar 27 2018 05:35
mandeephub sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4745 | @masd925 |http://www.freecodecamp.org/masd925
Markus Kiili
@Masd925
Mar 27 2018 05:35
Function called factorialize should only factorialize a number.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 06:03
I need to add a fail function in the object I pass to the .get method
so
it'd be like
.get({
url: "url",
success: function() { ...success function... },
fail: function() { ...fail function... }});
right?
Markus Kiili
@Masd925
Mar 27 2018 06:08
@Quantomistro3178 I think that you need to use .fail(...) https://api.jquery.com/jquery.get/
Success you can write like that if you like.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 06:10
var jqxhr = $.get( "example.php", function() {
  alert( "success" );
})
  .done(function() {
    alert( "second success" );
  })
What does it mean by "second success"?
$.get({
    url: "https://fcc-weather-api.glitch.me/api/current?lat=" + lat + "&lon=" + lon,
    success: function() {

  }
  }).fail(function() {alert("Sorry, weather API request failed.")});
So would this be ok?
oops
Markus Kiili
@Masd925
Mar 27 2018 06:16
@Quantomistro3178 Should be ok. Maybe easier to read if you use done and fail, instead of mixing the old and new way.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 06:16
@Masd925 Yeah, it looks confusing, i'll use done and fail instead
@Masd925 Thanks!
CamperBot
@camperbot
Mar 27 2018 06:17
quantomistro3178 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4746 | @masd925 |http://www.freecodecamp.org/masd925
MuhammadYasser1
@MuhammadYasser1
Mar 27 2018 07:50
what does the perfect protfolio of a freelancer front end developer should contains?
Dhaval Vira
@dhavalveera
Mar 27 2018 07:51
similar to Resume
your education history, work experience, projects
Abhi Indoria
@AIndoria
Mar 27 2018 08:11
So uh, if CodePen can't do Post-load javascript
how do I link it for projects?
I mean, can I link an actual website I made?
Dhaval Vira
@dhavalveera
Mar 27 2018 08:11
means
Abhi Indoria
@AIndoria
Mar 27 2018 08:14
or does it strictly have to be CodePen link?
Naga Ravi Teja Thoram
@ravitejathoram
Mar 27 2018 08:17

i defined an JS object:

var obj={name:1,name:2} //though key is same in both the key-value pairs there is no error

I tried accessing the value by doing "obj.name"

it returned "2" //which is quite obvious since 2 is the latest assignment to key "name"

But there is no point in this key-value pair if keys aren't unique, so is there any way to restrict the uniqueness on keys?

Johnny
@JohnnyBizzel
Mar 27 2018 08:21
@ravitejathoram Why no point? You designed a confusing object. It is up to you how you use the technology.
@ravitejathoram what happens when you inspect the object?
Naga Ravi Teja Thoram
@ravitejathoram
Mar 27 2018 08:26
I just wrote in the console and checked
Claudio Restifo
@Marmiz
Mar 27 2018 08:52
@ravitejathoram in fact the key is unique in the sense that both points to the same memory "address" thus they both will write in the same spot.
Hence why the last value is what remain in the object.
In that case your object will only have 1 key name with value 2
Naga Ravi Teja Thoram
@ravitejathoram
Mar 27 2018 08:57
ohh tq @Marmiz and @JohnnyBizzel
CamperBot
@camperbot
Mar 27 2018 08:57
ravitejathoram sends brownie points to @marmiz and @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1194 | @marmiz |http://www.freecodecamp.org/marmiz
:star2: 1814 | @johnnybizzel |http://www.freecodecamp.org/johnnybizzel
Johnny
@JohnnyBizzel
Mar 27 2018 08:58

@ravitejathoram in fact the key is unique in the sense that both points to the same memory "address" thus they both will write in the same spot.
Hence why the last value is what remain in the object.
In that case your object will only have 1 key name with value 2

This is what I expected :+1:

Naga Ravi Teja Thoram
@ravitejathoram
Mar 27 2018 08:59

consider following scenario

`function myForEach(arr, func){
for (var i=0;i<arr.length;i++){
func(arr[i]);}

}
`
my function call://colors is and array color=[1,2,3]

$myForEach(color,function(x,y){console.log(x,y);})

i got output:

1 undefined
2 undefined

3 undefined

4 undefined

so 2nd argument is implicitly becoming undefined but is there a way to impose constraints on the arguments of function that are being passed as parameter to myForEach function.

Johnny
@JohnnyBizzel
Mar 27 2018 08:59
@ravitejathoram use back ticks to show code
h1tag
@h1tag
Mar 27 2018 09:00

@AIndoria

Do I have to use CodePen for the front end projects?

As long as your code is publicly viewable somewhere on the internet, and you have a live demo, you can use whatever tools you want.

Check the FAQ on this page

Johnny
@JohnnyBizzel
Mar 27 2018 09:01
Ask, don't search, don't read
Claudio Restifo
@Marmiz
Mar 27 2018 09:04

@ravitejathoram

is there a way to impose constraints on the arguments of function

I have no clue what you mean. But in JS you can give default parameters to function (undefined is what is returned when a param is not specified)

Consider this example:

function f(x, y = 'default') {
 console.log(x,y)
}

f(1) //  1 'default'
f(2, 4) // 2 4

Is this what you want?

Stephen James
@sjames1958gm
Mar 27 2018 09:21
@ravitejathoram You can check the number of parameters are correct with func.length
But what would your function do if it was wrong? Throw an error, just return without running?
Dimitris Nik.
@dimitrissnk
Mar 27 2018 09:34
Can somebody tell me why the border radius of a div is not so "circled" ? See here: https://imgur.com/a/mbnh1
Dhaval Vira
@dhavalveera
Mar 27 2018 09:35
use border-radious: 50%;
Dimitris Nik.
@dimitrissnk
Mar 27 2018 09:37
@dhavalveera this is what happens. https://imgur.com/a/X5fS3
mustimuu
@mustimuu
Mar 27 2018 09:40
Hey guys and girls. Anybody here experienced with wordpress?
Dhaval Vira
@dhavalveera
Mar 27 2018 09:41
what help u need @mustimuu
mustimuu
@mustimuu
Mar 27 2018 09:42
@dhavalveera I have created a chil-theme.
I can't transfer the parents CSS to the child-theme. Something doesent work.
Heres the code: ```


/*
Theme Name: understrap Child
Theme URI: http://beproductive.dk/understrap-child/
Description: understrap Child Theme
Author: Musti
Author URI: http://bepductive.dk
Template: understrap
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: understrap-child
*/

<?php
function my_theme_enqueue_styles() {

    $parent_style = 'understrap-style'; // This is 'understrap-style' for the understrap theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
Dhaval Vira
@dhavalveera
Mar 27 2018 09:43
sorry second code is of PHP, an I am not a PHP Developer
mustimuu
@mustimuu
Mar 27 2018 09:45
no problem
how it look ?any advice
?
ArushiSinghania
@ArushiSinghania
Mar 27 2018 10:18
How can we make bubbles and animate it in html using css ??
habibaatify
@habibatify_twitter
Mar 27 2018 10:19
whit jquery
ArushiSinghania
@ArushiSinghania
Mar 27 2018 10:19
Ok but jquery is now not supported.
habibaatify
@habibatify_twitter
Mar 27 2018 10:20
i make it with jquery
ArushiSinghania
@ArushiSinghania
Mar 27 2018 10:20
Please give me code
Stephen James
@sjames1958gm
Mar 27 2018 10:22
@habibatify_twitter Looks good - For your blog entries, I would also make the titles clickable. The items in your portfolio should also be clickable?
ArushiSinghania
@ArushiSinghania
Mar 27 2018 10:24
@sjames1958gm Can you help me in making bubbles and animating it with CSS ??
Stephen James
@sjames1958gm
Mar 27 2018 10:25
@ArushiSinghania I am still a novice with the CSS, I am sure there are tutorials on you tube that would do a much better job
ArushiSinghania
@ArushiSinghania
Mar 27 2018 10:27
@sjames1958gm Ok and thanks for advice. I will try.
CamperBot
@camperbot
Mar 27 2018 10:27
arushisinghania sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9138 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
habibaatify
@habibatify_twitter
Mar 27 2018 10:27
@sjames1958gm thanks
Stephen James
@sjames1958gm
Mar 27 2018 10:28
@habibatify_twitter :+1:
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:46
Hello friends somebody could help me
i am really stuck here
i have completed a challenge in FCC but the interpreter of the website get stuck
i dont know whay
why
Nate Mallison
@NJM8
Mar 27 2018 10:46
@rubendmatos1985 post your question and we will do our best
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:47
@NJM8 thanks here i go but i must to say that i tried my code in visual studio and works perfectly
CamperBot
@camperbot
Mar 27 2018 10:47
rubendmatos1985 sends brownie points to @njm8 :sparkles: :thumbsup: :sparkles:
:cookie: 369 | @njm8 |http://www.freecodecamp.org/njm8
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:47
@NJM8 i thought that was problems with my logic but it is good

@NJM8 function smallestCommons(arr) {
/Determinate wich number its bigger to make an Array of numbers between them/
var firstNum=arr[0];
var secondNum=arr[1];
var arrTestedNum=[];
if(firstNum >= secondNum){
for (var i=1; i<firstNum+1; i++){
arrTestedNum.push(i);
}
}else{
for (var j=1; j<secondNum+1; j++){
arrTestedNum.push(j);
}
}
/Read the Array of numbers to multiply them and find a commun multiple/
var factor = arrTestedNum.length+1;
var power = false;
while(power===false){
var arrResult =[];
for(var g=0; g<arrTestedNum.length; g++){
arrResult.push(factor/arrTestedNum[g]);
}

var notInteger=[];
for(var a=0; a<arrResult.length; a++){
  if(Number.isInteger(arrResult[a])=== false){
    notInteger.push(arrResult[a]);}
}
if(notInteger.length===0){
power = true;
break;
}else{
  factor ++;
}
 }//fin del while
return; 

}

smallestCommons([1,13]);

Nate Mallison
@NJM8
Mar 27 2018 10:48
are you getting the error on smallest commons
yup, haha
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:49
@NJM8 the name of the challenge it is "Smallest Common Multiple"
@NJM8 thats exactly what the code do
but in visual studio
Nate Mallison
@NJM8
Mar 27 2018 10:49
and you get this error on the website?
// potential infinite loop etc etc
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:51
@NJM8 no potencial infinite error maybe
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:52
@NJM8 thats not what i see
i am working with mozilla firefox
@NJM8 but i can not understand
@NJM8 the code is correct write?
Nate Mallison
@NJM8
Mar 27 2018 10:53
your code is probably correct, the code runner for the FCC that checks your code stops running if a process takes more than 500 ms
so test your code on fcc, when it fails there will be a line with an X on it. put //noprotect above this line to prevent the 500ms limit
just be aware this will allow your browser to crash if you do indeed have an infinite loop. but if your code runs locally you should be ok
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:56
@NJM8 thanks
CamperBot
@camperbot
Mar 27 2018 10:56
rubendmatos1985 sends brownie points to @njm8 :sparkles: :thumbsup: :sparkles:
api offline
Nate Mallison
@NJM8
Mar 27 2018 10:57
sure thing!
Ruben Dario
@rubendmatos1985
Mar 27 2018 10:59
@NJM8 wher i must to write //noprotect??
Nate Mallison
@NJM8
Mar 27 2018 11:06
I think just add it to the top
I error message on mine says to put it at a certain line but I tried at the top and it works
Ruben Dario
@rubendmatos1985
Mar 27 2018 11:12
@NJM8 it is not working
@NJM8 it makes the same
@NJM8 that is frustrating man
@NJM8 i dont understand the code it is good
@NJM8 thanks i will keep trying
CamperBot
@camperbot
Mar 27 2018 11:13
rubendmatos1985 sends brownie points to @njm8 :sparkles: :thumbsup: :sparkles:
api offline
Nate Mallison
@NJM8
Mar 27 2018 11:16
does the box at the left say what line? You may need to put //noprotect right above that line. Also have you tested your code against all the supplied test cases?
Ruben Dario
@rubendmatos1985
Mar 27 2018 11:22
@NJM8 i will copy and paste the solution
@NJM8 i have tried to many times
@NJM8 with sublime
@NJM8 with visual studio
@NJM8 it is some problem of the interpreter a think
@NJM8 look at here
it is not a looping problem
@NJM8 it is not a looping problem
Ruben Dario
@rubendmatos1985
Mar 27 2018 11:27
@NJM8 anyway thanks for your help but it would be intersting to analyze why it is happening tha
CamperBot
@camperbot
Mar 27 2018 11:27
rubendmatos1985 sends brownie points to @njm8 :sparkles: :thumbsup: :sparkles:
api offline
Stephen James
@sjames1958gm
Mar 27 2018 11:50
@rubendmatos1985 Your code loops way too much for FCC. You loop twice over the numbers for each number you check.
since the answer is 360360 that is 360360 * 13 * 2
Your starting factor should be factor = arrTestedNum[arrTestedNum.length+1];
Which is coincidently the same value for [1, 13] but won't be for [18,23]
Also, you can increment your factor by arrTestedNum[arrTestedNum.length+1] rather than 1
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:15
How do I access the data using a .get() request?
 $.get(fccurl).done(function(data){
    alert("Get request successful!");

  })
      .fail(function() {alert("Sorry, weather API request failed.")});
    console.log(lat + "\n" + lon);
function passed to .done() has the data from the request, right?
Markus Kiili
@Masd925
Mar 27 2018 12:18
@Quantomistro3178 No, the respose data is passed into the done callback.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:19
yeah, so I write my success function in done right?
Markus Kiili
@Masd925
Mar 27 2018 12:19
@Quantomistro3178 Yes.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:20
Got it.
But .getCurrentPosition isn't working for me, for some reason
i've allowed access to location in my browser, but it still returns undefined for both lat and lon
is it working for you, or is there something wrong with my code?
Markus Kiili
@Masd925
Mar 27 2018 12:29
@Quantomistro3178 Not sure why geolocations fails, but also you need to use lat and long inside the geolocation success callback. Lat and long get values at some point later when the geolocation response comes (That is after the script has finished executing).
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:31
...I don't get it
geolocation was working for me some time ago, I don't remember what I did differently then
Markus Kiili
@Masd925
Mar 27 2018 12:34
@Quantomistro3178 The geolocation success callback that gives values to lat and long is executed later when the response comes. The script is executed immediately, so using lat and long in the script will evaluate to undefined.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:34
oh, I see
Markus Kiili
@Masd925
Mar 27 2018 12:35
So only inside the success callback you know that the response has come. So use lat and long inside the callback. You can for example call another function there and pass lat and long as arguments.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:36
So I can just shift everything relevant into the success function, so it only executes once the response comes
Markus Kiili
@Masd925
Mar 27 2018 12:38
@Quantomistro3178 Yes, that is the basic solution. If you have several async calls, using promises can make the code easier to read because it avoids making deeply nested code.
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:38
what are promises?
Ken Haduch
@khaduch
Mar 27 2018 12:51
@Quantomistro3178 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise - there is the documentation on promises
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:52
Oh no, docs! My worst nightmares!
xD
Ken Haduch
@khaduch
Mar 27 2018 12:52
:)
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:53
@khaduch Thanks, though!
CamperBot
@camperbot
Mar 27 2018 12:53
quantomistro3178 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3826 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Mar 27 2018 12:53
it's an easier way to write code for asynchronous transactions, instead of using the AJAX calls
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:54
Yeah, i'm reading the docs
Ken Haduch
@khaduch
Mar 27 2018 12:55
@Quantomistro3178 - A youTube link - maybe easier to watch a short video tutorial?
Quantomistro3178
@Quantomistro3178
Mar 27 2018 12:56
@khaduch Much easier >.< thanks for that!
CamperBot
@camperbot
Mar 27 2018 12:56
quantomistro3178 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
api offline
Ken Haduch
@khaduch
Mar 27 2018 12:58
@Quantomistro3178 - going to that youtube page you will, of course, see a lot of other links to other videos that explain promises in different ways. Watch a few :) !!
Gilbert
@GilTorch
Mar 27 2018 14:42
Finished my React Markdown Previewer. Please give your feedback:
https://codepen.io/BlessedCamper/full/MVOJYV/
Ken Haduch
@khaduch
Mar 27 2018 15:01
@GilTorch - your markdown previewer looks like it works well. I like that you provided sample text, although I wondered if a "help" popup would be a good idea for this project? But it looks good!
Gilbert
@GilTorch
Mar 27 2018 15:02
@khaduch An Help popup that tell how to write markdown?
Ken Haduch
@khaduch
Mar 27 2018 15:11
yes - just a guide to what the markdown features that are supported by the app?
Chenyang
@chenyang48671155
Mar 27 2018 15:12
what's reposvie layouts?
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 27 2018 15:13
@chenyang48671155 Responsive layouts are layouts that can adapt to any screen size

@chenyang48671155

Responsive design is an approach to web page creation that makes use of flexible layouts, flexible images and cascading style sheet media queries. The goal of responsive design is to build web pages that detect the visitor's screen size and orientation and change the layout accordingly.

Chenyang
@chenyang48671155
Mar 27 2018 15:14
@MuhammedKarim thank you guy,I understand it awesome
CamperBot
@camperbot
Mar 27 2018 15:14
chenyang48671155 sends brownie points to @muhammedkarim :sparkles: :thumbsup: :sparkles:
:cookie: 235 | @muhammedkarim |http://www.freecodecamp.org/muhammedkarim
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 27 2018 15:14
@chenyang48671155 You're welcome :)
wray-goenergies
@wray-goenergies
Mar 27 2018 16:56
Am I allowed post an image link? Can't seem to find a name of this kind of UI, if it even has a name.
steve84
@raynor84
Mar 27 2018 17:32

Hi, i cant get a solution on this:

function translatePigLatin(str) {
var vowel=["a", "e", "i", "o", "u"];
arr = str.split("");
var counter=0;
for(var s=0; s<str.length; s++) {

for(var i=0; i<vowel.length; i++) {
  if(arr.indexOf(vowel[i])!=0) {
    counter++;
  } else {
    str+="way";
    break;
  }

}
if(counter==vowel.length) {
  var consonant = str[0];
  str = str.substr(s+1, str.length-1);
  str+=consonant+"ay";


}

}

return str;
}

translatePigLatin("eight");

steve84
@raynor84
Mar 27 2018 17:39
any ideas
Aditya
@ezioda004
Mar 27 2018 17:40
@raynor84 You're mutating the str string which is causing an infinite loop.
Nate Mallison
@NJM8
Mar 27 2018 17:47
@raynor84 You don't need to loop through the string if the first letter is a vowel, just tack way on the end and return
steve84
@raynor84
Mar 27 2018 17:49
@NJM8 that way glove won't be oveglay
all the consonant need to be put at the end as well
Nate Mallison
@NJM8
Mar 27 2018 17:50
@raynor84 You don't need loops at all :smile:
Nate Mallison
@NJM8
Mar 27 2018 18:01
Hey can you guys give me some feedback on my calculator?
steve84
@raynor84
Mar 27 2018 18:05
The +- button doesn't work properly
Nate Mallison
@NJM8
Mar 27 2018 18:18
How would you expect it to work?
I may just have programmed it differently, I probably should've used a calculator for ideas, haha
steve84
@raynor84
Mar 27 2018 18:22
when i press a number and than +- and another number than it shows something like 9-8
Nate Mallison
@NJM8
Mar 27 2018 18:23
it should be putting in a negative number, so if you press 9, plusminus, 8, it will be 9 -8, if you press 9, minus, 8, it should be 9 - 8 (should be spaces in there)
steve84
@raynor84
Mar 27 2018 18:27
but if you press equal there is no result showing upp
Nate Mallison
@NJM8
Mar 27 2018 18:37
ah yes, I didn't account for just entering 9 -8, did you try something with an operator and not just two numbers?
Aditya
@ezioda004
Mar 27 2018 18:39
@NJM8 It looks good but a few things, your calculator doesn't account for input overflow and I'm able to input multiple dots like 2.2.2.2. which shouldnt happen. Also, in calculators the expression evaluates left to right without following operator precedence of */+-. Example in normal calculator 7 + 8 * 2 = 30 but in yours due to operator precedence 7 + 8 * 2 = 23.
Nate Mallison
@NJM8
Mar 27 2018 18:49
@ezioda004 thanks! It should be accounting for operator order, I'll look at that
CamperBot
@camperbot
Mar 27 2018 18:49
njm8 sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 511 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Nate Mallison
@NJM8
Mar 27 2018 18:50
I didn't think to test the . button at all
Nate Mallison
@NJM8
Mar 27 2018 18:58
@ezioda004 It should be 23 no?
7 + 8 * 2
7 + 16
23?
PEMDAS?
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 27 2018 18:59
@NJM8 I think that should be correct
Aditya
@ezioda004
Mar 27 2018 18:59
@NJM8 Yes, thats correct but if you open any regular calculator they dont follow any operator precedence rule, only evaluate expression left to right
Screenshot (47).png
Nate Mallison
@NJM8
Mar 27 2018 19:02
That calc is following the order, as does the one on my phone, but the example app from the FCC challenge page does not
I guess it depends on what you expect the calculator to do. I could put in a button to switch it
Aditya
@ezioda004
Mar 27 2018 19:05
Thats weird, I followed beta example and it follow the order I mentioned
https://beta.freecodecamp.org/en/challenges/front-end-libraries-projects/build-a-javascript-calculator
Nate Mallison
@NJM8
Mar 27 2018 19:05
But I think I will leave it, already made more than they asked for. :smile:
Note On Calculator Logic: It should be noted that there are two main schools of thought on calculator input logic: immediate execution logic and formula logic. Our example utilizes formula logic and observes order of operation precedence, immediate execution does not. Either is acceptable, but please note that depending on which you choose, your calculator may yield different results than ours for certain equations (see below example). As long as your math can be verified by another production calculator, please do not consider this a bug.
from their notes
So I guess either is ok
Aditya
@ezioda004
Mar 27 2018 19:07
Yes, I just read that. I guess you shouldnt worry about it then :D
Nate Mallison
@NJM8
Mar 27 2018 19:08
I will note that the calc example in the regular curriculum uses immediate execution, but it also uses eval
not good!
personally I think my input parser is pretty freaking slick, so I'll keep it that way, haha
Aditya
@ezioda004
Mar 27 2018 19:13
Yeah, they're not so consistent. In the beta they say the calculator uses "formula logic" but if you follow codepen link from there it uses "immediate execution logic". This should be a typo.
LKian
@LKian
Mar 27 2018 20:26
I finished jquery last yr and then kind of abandoned it. Now i'm going back to review and don't understand one of the lessons.
$(".target:nth-child(2)").addClass("animated bounce");
why does that only target the one button in the right well (instead of left well? nth-child(2) should be on the left side, if there are 6 buttons.
and all have the class of ".target"
Aditya
@ezioda004
Mar 27 2018 20:42
@LKian It seems to select buttons from both well for me as it should.
JoEezy
@JoEeeezy_twitter
Mar 27 2018 20:43
yeah same here both left and right bounced
Barbara Pentoney
@flyfishingbarbara
Mar 27 2018 20:44
hi all- i need help with weather app....specifically with 'clicking button and converting celsius to fahrenheit and displaying where the 'number' is...??ughhh am i close with the commented-out lines 33 and 34....not sure what to do..?? thanks!
https://codepen.io/flyfishingbarbara/pen/XZoKyz?editors=0011
JoEezy
@JoEeeezy_twitter
Mar 27 2018 20:55
@flyfishingbarbara try adding this at the end of your weather function :
     $("#convert").on("click", function(){

  $("#temp").html(temp * 9 / 5 + 32);
Gulsvi
@gulsvi
Mar 27 2018 20:59
@flyfishingbarbara One easy way to do this is to add an element for the temperature in Fahrenheit and another one for the temperature in Celsius, and .hide() one of the elements. When you click the button, use .toggle() to hide/show the elements. Spoiler Code
JoEezy
@JoEeeezy_twitter
Mar 27 2018 21:01
i think it wasn't working because you were trying to access temp from another function where it wasn't defined in
Barbara Pentoney
@flyfishingbarbara
Mar 27 2018 21:07
@JoEeeezy_twitter @gulsvi thanks for the help! i will take a look and keep fingers crossed...haha thnx again!
CamperBot
@camperbot
Mar 27 2018 21:07
flyfishingbarbara sends brownie points to @joeeeezy_twitter and @gulsvi :sparkles: :thumbsup: :sparkles:
api offline
:star2: 2688 | @gulsvi |http://www.freecodecamp.org/gulsvi
Barbara Pentoney
@flyfishingbarbara
Mar 27 2018 21:37
@gulsvi ....how did you add that 'spoiler code' in this chat...? did you use 'embed' button at the bottom of codepen?? curious..
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 27 2018 21:41
image.png
@flyfishingbarbara He wrote spolier code in the [] and the link in the ()
Barbara Pentoney
@flyfishingbarbara
Mar 27 2018 21:42
@MuhammedKarim oh cool! thnks!...
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 27 2018 21:44
@flyfishingbarbara you're welcome :)
Gulsvi
@gulsvi
Mar 27 2018 21:47
Good job, you got it @flyfishingbarbara :)
Barbara Pentoney
@flyfishingbarbara
Mar 27 2018 21:48
@gulsvi thnx... every day learn something new! love it!
CamperBot
@camperbot
Mar 27 2018 21:48
flyfishingbarbara sends brownie points to @gulsvi :sparkles: :thumbsup: :sparkles:
api offline