``` var f = data.main.temp * 9 / 5 - 459.67;
var c = data.main.temp - 273.15;
console.log(f.split('.'))
```
f
?
chriswingler sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2620 | @moigithub |http://www.freecodecamp.com/moigithub
https://
. It is currently starting with http://
https://codepen.io/ibanton/pen/jyrNLj
kikykindagirl sends brownie points to @rami90 :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @rami90 |http://www.freecodecamp.com/rami90
kikykindagirl sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1420 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
<img alt="Computer Monster" src="http://www.vectorportal.com/img_novi/computer-alien.jpg">
table-responsive
around the table and it adds a scroll bar on smaller screens.
winroy sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1421 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Hint: Here are mp3s you can use for each button: https://s3.amazonaws.com/freecodecamp/simonSound1.mp3, https://s3.amazonaws.com/freecodecamp/simonSound2.mp3, https://s3.amazonaws.com/freecodecamp/simonSound3.mp3, https://s3.amazonaws.com/freecodecamp/simonSound4.mp3.
willow606 sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1970 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
coymeetsworld sends brownie points to @willow606 :sparkles: :thumbsup: :sparkles:
:cookie: 303 | @willow606 |http://www.freecodecamp.com/willow606
kasmin23 sends brownie points to @st3ps and @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 358 | @st3ps |http://www.freecodecamp.com/st3ps
:star2: 1971 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
mohammadhasham sends brownie points to @willow606 :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @willow606 |http://www.freecodecamp.com/willow606
sorinr sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1972 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
body {
min-height: 100vh;
font-family: 'Roboto Slab', serif;
color: #4D85D1;
padding: 10px;
font-size: 30px;
background-image: url("http://static.pexels.com/photos/625/field-summer-sun-meadow.jpg");
background-size: cover;
background-position: top center;
background-repeat: no-repeat;
}
chungeric sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1146 | @sorinr |http://www.freecodecamp.com/sorinr
:star2: 1973 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
sorinr sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
$("#get_quote").on("click",function(){
$("#main_block").html("<h1>It works!</h1>");
});
</script>
<div class="jumbotron" id="banner">
<h1 class="text-center">Random Quote Machine</h1>
</div>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="jumbotron" id="main_block">
<p class="panel panel-body"></p>
</div>
<form>
<div class="row">
<div class="col-md-12 col-md-offset-5">
<button id="get_quote" class="btn btn-inverse">Get New Quote</button>
</div>
</div>
</form>
</div>
</div>
</div>
``` <script>
$("#get_quote").on("click",function(){
$("#main_block").html("<h1>It works!</h1>");
});
</script>
<div class="jumbotron" id="banner">
<h1 class="text-center">Random Quote Machine</h1>
</div>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="jumbotron" id="main_block">
<p class="panel panel-body"></p>
</div>
<form>
<div class="row">
<div class="col-md-12 col-md-offset-5">
<button id="get_quote" class="btn btn-inverse">Get New Quote</button>
</div>
</div>
</form>
</div>
</div>
</div>
$(document).ready(function () {
...
});
yellowSound(); (in line 123) , simonPattern();
reStart(); (in line 127-129)
turnOn();
These functions should be declared before its usage see the colour of those functions.so i think this might be your issue
Like this :
<link href = "css/bootstrap.min.css" rel = "stylesheet" type = "text/css">
That is, if you downloaded it.
$("#mblock").html("It works!");
sharang108 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1147 | @sorinr |http://www.freecodecamp.com/sorinr
gjergjk71 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1148 | @sorinr |http://www.freecodecamp.com/sorinr
Hi. Technically, I’ve completed the Basic front-end projects’ ‘Build a tribute page’ exercise, but there were a couple of things that troubled me when I was working on it.
Link to pen: http://codepen.io/architchandra/pen/apmdWP/
If anyone would be kind enough to go through the code (marked in the code in the form of comments) and help me understand why these things were happening, I’ll be very grateful.
Thanks!
@saylos Let me give you an example of how to do it with jQuery. This is from the Wikipedia API documentation:
$.ajax( {
url: remoteUrlWithOrigin,
data: queryData,
dataType: 'json',
type: 'POST',
headers: { 'Api-User-Agent': 'Example/1.0' },
success: function(data) {
// do something with data
}
} );
url should be the API url, followed by parameters, An example with the english-language wikipedia would be something like this: https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json
. The https://en.wikipedia.org/w/api.php?
part stays the same for every request, but the parameters that follow it should be built up as a string for every request individually. Or you could include the parameters with data
property. Another important thing is the success function. It is called automatically when the response arrives from the api for that request. Here, data
that is automatically passed to the success function is the json response that you can use.
origin=*
to the list of parameters.
saylos sends brownie points to @tariellaelius :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @tariellaelius |http://www.freecodecamp.com/tariellaelius
imondal007 sends brownie points to @tariellaelius :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @tariellaelius |http://www.freecodecamp.com/tariellaelius
<div class="row">
<div class="col-md-4">
to the portfolio section. Why?
stevo99 sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 383 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
I am trying to change my text on-click, but it is somehow not working. I double checked and compared it to the exercise "change text with click events" but still can't find the problem, help is very much appreciated!!
$("#quote-text").html("Here is quote number2");
alexg1990 sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 384 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
document.getElementById('quote-text).innerHTML = "Here is quote number2";
alexg1990 sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:warning: alexg1990 already gave nitinnair89 points
<div class="background3" id="page3">
stevo99 sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:warning: stevo99 already gave nitinnair89 points
stevo99 sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 385 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
min-width: 80%;
to your header
width: 100%;
position: fixed;
it doesn't behave as normally and doesn't automatically expand to its parents anymore.
box-sizing: border-box;
@UsamaHameed It expands an expression into another.
Means in case of when you use the spread operator in a parameter list as:function(...params)
the variable params
will hold all the arguments passed to the function as an array.
If you then want to call another function which takes a number of arguments, but not in array format - but you have an array - you can use the spread operator to apply the values in the array each as if you would seperate them with a simple commata.someFuncCall(...params);
Hey fellow campers. I hope you are doing well. :)
<div class = "article-container" id = "article1"></div>
<div class = "article-container" id = "article2"></div>
<div class = "article-container" id = "article3"></div>
<div class = "article-container" id = "article4"></div>
<div class = "article-container" id = "article5"></div>
function(jsonData){
console.log(jsonData);
for (var i=0; i<6; i++){
// output div ist article[i]
var output = $("#article"+i);
output.innerHTML = jsonData[1][i];
}
})// end of JSON function
This function is supposed to go through the JSON data and put the first 5 results into the according divs. It doesn't do that. I suppose that either i isn't counting upward or that this selector
var output = $("#article"+i);
is not right. What do I have to do to make it work?
params
is [1,2,3]
this would be equivalent to calling someFuncCall(1, 2, 3)
@UsamaHameed
output
is a jQuery
object (value) and not a normal DOM object.output.html(jsonData[1][i]);
instead since .innerHTML
doesn't exist on a jQuery object.
:cookie: 751 | @alpox |http://www.freecodecamp.com/alpox
philipp32 sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
usamahameed sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 752 | @alpox |http://www.freecodecamp.com/alpox
text-size-adjust
but it isn't supported on all browsers yet.
@janepohorecka
max-width: 1300px;
width: 100%;
Does that help?
ghulamshabir sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1422 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
box-sizing: border-box;
. You had content: border-box;
which is not valid
sorry asafharari, you can't send brownie points to yourself! :sparkles: :sparkles:
@bigyankarki Maybe I can explain it better than I did yesterday. Try running this code alone:
var weatherId;
var apiAddress = "http://api.openweathermap.org/data/2.5/weather?lat=40&lon=74&units=imperial&type=accurate&APPID=9d4a841a5b68f2cc43c97d5224e11086";
$.getJSON(apiAddress, function(weatherData) {
weatherId = weatherData.weather[0].id;
});
console.log(weatherId);
What is weatherId
equal to?
var weatherId;
var apiAddress = "http://api.openweathermap.org/data/2.5/weather?lat=40&lon=74&units=imperial&type=accurate&APPID=9d4a841a5b68f2cc43c97d5224e11086";
$.getJSON(apiAddress, function(weatherData) {
weatherId = weatherData.weather[0].id;
logWeatherId(weatherId);
});
function logWeatherId(weatherId) {
console.log(weatherId);
}
in the twitchtv project, does the response property stream: null
mean that freecodecamp isn't streaming?
i don't know what i'm looking at here, and don't know how to find out.
thanks @username
chocolatechimpcookie sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1423 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
<body>
<header><nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container fluid">
<div class="navbar-header">
<a href="#" class="navbar-brand ">Allan Moses Fernandes </a>
</div>
<!-- Menu -->
<div>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</header>
<h1>
Allan is Home </h1>
somehow my <h1> ends up in the navigation bar could someone help me get it out of there
//get the address from the IP Geolocation API
function getLocation() {
$.getJSON("http://ip-api.com/json", function(loc){
$("#cityName").text(loc.city + ', ' + loc.regionName + ', ' + loc.country)
getWeather(loc.lat, loc.lon);
})
.fail(function(err) {
getWeather()
});
}
getLocation();
//Retreive temperature details from openweathermap.org using longitude and latitude from previous API
function getWeather(lat, lon) {
var apiAddress = "http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&units=imperial&type=accurate&APPID=9d4a841a5b68f2cc43c97d5224e11086";
$.getJSON(apiAddress, function (weatherData){
tempF = weatherData.main.temp.toFixed(0);
tempC = ((tempF- 32)*(5/ 9)).toFixed(0);
weather = weatherData.weather[0].description;
weatherId = weatherData.weather[0].id ;
console.log(weatherId);
wind= weatherData.wind.speed;
$("#weather").text(weather + ', Wind speed: ' + wind + ' mph');
$("#temp").text(tempF + ' °F');
});
}
function logWeatherData (weatherId) {
console.log(weatherId);
}
//to convert celcius into farenheit using data from earlier function.
$("#conversion").click(function() {
if($("#temp").text().indexOf('F') > -1) {
$("#temp").text(tempC + ' °C');
}
else {
$("#temp").text(tempF + ' °F');
}
})
//to change the background image according to weather.
var imageArray = [];
var png = ['01d', '01n', '02d', '02n', '03d', '03n', '04d', '04n', '09d', '09n', '10d', '10n', '11d', '11n', '13d', '13n', '50d', '50n'];
var bodyImages = [/*clear sky*/ 'https://media.giphy.com/media/l3vRoeR8KaNNs3g88/giphy.gif',
/* clear night*/
'https://media.giphy.com/media/SE5Qvze2QBpbq/source.gif',
/* few clouds*/
'https://media.giphy.com/media/o6qaN00DUo7x6/giphy.gif',
/*few clouds night*/
'https://media.giphy.com/media/R19AHAAwMnEpa/giphy.gif',
/*scattered clouds*/
'https://media.giphy.com/media/qZMonv0Jty1P2/giphy.gif',
/*night scattered clouds*/
'https://media.giphy.com/media/afuXKLnDHbb8I/giphy.gif',
/*broken clouds*/
'https://s-media-cache-ak0.pinimg.com/originals/58/25/32/58253287ef7d5f5bccc3490d64017ffd.jpg',
/*night brokenn clouds*/
'http://www.troyjohnstone.com/astrophotography/images/sky_clouds_night_moon_2006_09_09_04.jpg',
/*shower rain*/
'https://media.giphy.com/media/oaNFVNEcvWv5K/giphy.gif',
/*night shower rain*/
'https://s-media-cache-ak0.pinimg.com/originals/52/07/68/5207680e1eafd7233ab094b5f910e6af.gif',
/*rain*/
'https://media.giphy.com/media/BAD9hUGYZkqPe/giphy.gif',
/*night rain*/
'http://umad.com/img/2015/6/night-rain-gif-9410-9796-hd-wallpapers.jpg',
/*thunderstorm*/
'https://media.giphy.com/media/8xY1YYpEZ4dws/giphy.gif',
/*night thunderstorm*/
'https://media.giphy.com/media/8xY1YYpEZ4dws/giphy.gif',
/*snow*/
'https://media.giphy.com/media/OdOfTkw2uVADC/giphy.gif',
/*night snow*/
'https://media.giphy.com/media/Ok928ivi56clq/giphy.gif',
/*mist*/
'https://media.giphy.com/media/LmC5rpntvJPxe/giphy.gif',
/*night mist*/
'https://media.giphy.com/media/ofrQ8FYfTD8gE/giphy.gif'
];
var imageArray = [];
for (var i = 0; i < png.length; i++) {
for (var j = 0; j < bodyImages.length; j++){
if (png[i] == weatherId) {
imageArray.push(bodyImages[j]);
$("body").css('background-image', 'url('+ imageArray[i] +')');
}
}
}
body {
padding-top: 50px;
}
$.getJSON("http://ip-api.com/json", function(loc){
$("#cityName").text(loc.city + ', ' + loc.regionName + ', ' + loc.country)
getWeather(loc.lat, loc.lon);
})
//get the address from the IP Geolocation API
function getLocation() {
$.getJSON("http://ip-api.com/json", function(loc){
$("#cityName").text(loc.city + ', ' + loc.regionName + ', ' + loc.country)
getWeather(loc.lat, loc.lon);
})
.fail(function(err) {
getWeather()
});
}
getLocation();
//Retreive temperature details from openweathermap.org using longitude and latitude from previous API
function getWeather(lat, lon) {
var apiAddress = "http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&units=imperial&type=accurate&APPID=9d4a841a5b68f2cc43c97d5224e11086";
$.getJSON(apiAddress, function (weatherData){
tempF = weatherData.main.temp.toFixed(0);
tempC = ((tempF- 32)*(5/ 9)).toFixed(0);
weather = weatherData.weather[0].description;
weatherId = weatherData.weather[0].id ;
console.log(weatherId);
wind= weatherData.wind.speed;
$("#weather").text(weather + ', Wind speed: ' + wind + ' mph');
$("#temp").text(tempF + ' °F');
//to change the background image according to weather.
var imageArray = [];
var png = ['01d', '01n', '02d', '02n', '03d', '03n', '04d', '04n', '09d', '09n', '10d', '10n', '11d', '11n', '13d', '13n', '50d', '50n'];
var bodyImages = [/*clear sky*/ 'https://media.giphy.com/media/l3vRoeR8KaNNs3g88/giphy.gif',
/* clear night*/
'https://media.giphy.com/media/SE5Qvze2QBpbq/source.gif',
/* few clouds*/
'https://media.giphy.com/media/o6qaN00DUo7x6/giphy.gif',
/*few clouds night*/
'https://media.giphy.com/media/R19AHAAwMnEpa/giphy.gif',
/*scattered clouds*/
'https://media.giphy.com/media/qZMonv0Jty1P2/giphy.gif',
/*night scattered clouds*/
'https://media.giphy.com/media/afuXKLnDHbb8I/giphy.gif',
/*broken clouds*/
'https://s-media-cache-ak0.pinimg.com/originals/58/25/32/58253287ef7d5f5bccc3490d64017ffd.jpg',
/*night brokenn clouds*/
'http://www.troyjohnstone.com/astrophotography/images/sky_clouds_night_moon_2006_09_09_04.jpg',
/*shower rain*/
'https://media.giphy.com/media/oaNFVNEcvWv5K/giphy.gif',
/*night shower rain*/
'https://s-media-cache-ak0.pinimg.com/originals/52/07/68/5207680e1eafd7233ab094b5f910e6af.gif',
/*rain*/
'https://media.giphy.com/media/BAD9hUGYZkqPe/giphy.gif',
/*night rain*/
'http://umad.com/img/2015/6/night-rain-gif-9410-9796-hd-wallpapers.jpg',
/*thunderstorm*/
'https://media.giphy.com/media/8xY1YYpEZ4dws/giphy.gif',
/*night thunderstorm*/
'https://media.giphy.com/media/8xY1YYpEZ4dws/giphy.gif',
/*snow*/
'https://media.giphy.com/media/OdOfTkw2uVADC/giphy.gif',
/*night snow*/
'https://media.giphy.com/media/Ok928ivi56clq/giphy.gif',
/*mist*/
'https://media.giphy.com/media/LmC5rpntvJPxe/giphy.gif',
/*night mist*/
'https://media.giphy.com/media/ofrQ8FYfTD8gE/giphy.gif'
];
var imageArray = [];
for (var i = 0; i < png.length; i++) {
for (var j = 0; j < bodyImages.length; j++){
if (png[i] == weatherId) {
imageArray.push(bodyImages[j]);
$("body").css('background-image', 'url('+ imageArray[i] +')');
}
}
}
});
}
function logWeatherData (weatherId) {
console.log(weatherId);
}
//to convert celcius into farenheit using data from earlier function.
$("#conversion").click(function() {
if($("#temp").text().indexOf('F') > -1) {
$("#temp").text(tempC + ' °C');
}
else {
$("#temp").text(tempF + ' °F');
}
})
the tweeting part is still incomplete
png[i] == weatherId
@nikkilr88 You'll need to have the menubarsclose and toggle class set when the page first loads:
<i class="fa fa-bars menubars menubarsclose"></i>
<div class="container-fluid content">
<div class="sidebar toggle">
Update your HTML with that and I believe you'll get it working the way you want
//get the address from the IP Geolocation API
function getLocation() {
$.getJSON("http://ip-api.com/json", function(loc){
$("#cityName").text(loc.city + ', ' + loc.regionName + ', ' + loc.country)
getWeather(loc.lat, loc.lon);
})
.fail(function(err) {
getWeather()
});
}
getLocation();
//Retreive temperature details from openweathermap.org using longitude and latitude from previous API
function getWeather(lat, lon) {
var apiAddress = "http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&units=imperial&type=accurate&APPID=9d4a841a5b68f2cc43c97d5224e11086";
$.getJSON(apiAddress, function (weatherData){
tempF = weatherData.main.temp.toFixed(0);
tempC = ((tempF- 32)*(5/ 9)).toFixed(0);
weather = weatherData.weather[0].description;
weatherId = weatherData.weather[0].id ;
console.log(weatherId);
logWeatherId(weatherId);
wind= weatherData.wind.speed;
$("#weather").text(weather + ', Wind speed: ' + wind + ' mph');
$("#temp").text(tempF + ' °F');
});
}
//to convert celcius into farenheit using data from earlier function.
$("#conversion").click(function() {
if($("#temp").text().indexOf('F') > -1) {
$("#temp").text(tempC + ' °C');
}
else {
$("#temp").text(tempF + ' °F');
}
})
//to change the background image according to weather.
function logWeatherId(weatherId) {
var imageArray = [];
var png = ['01d', '01n', '02d', '02n', '03d', '03n', '04d', '04n', '09d', '09n', '10d', '10n', '11d', '11n', '13d', '13n', '50d', '50n'];
var bodyImages = [/*clear sky*/ 'https://media.giphy.com/media/l3vRoeR8KaNNs3g88/giphy.gif',
/* clear night*/
'https://media.giphy.com/media/SE5Qvze2QBpbq/source.gif',
/* few clouds*/
'https://media.giphy.com/media/o6qaN00DUo7x6/giphy.gif',
/*few clouds night*/
'https://media.giphy.com/media/R19AHAAwMnEpa/giphy.gif',
/*scattered clouds*/
'https://media.giphy.com/media/qZMonv0Jty1P2/giphy.gif',
/*night scattered clouds*/
'https://media.giphy.com/media/afuXKLnDHbb8I/giphy.gif',
/*broken clouds*/
'https://s-media-cache-ak0.pinimg.com/originals/58/25/32/58253287ef7d5f5bccc3490d64017ffd.jpg',
/*night brokenn clouds*/
'http://www.troyjohnstone.com/astrophotography/images/sky_clouds_night_moon_2006_09_09_04.jpg',
/*shower rain*/
'https://media.giphy.com/media/oaNFVNEcvWv5K/giphy.gif',
/*night shower rain*/
'https://s-media-cache-ak0.pinimg.com/originals/52/07/68/5207680e1eafd7233ab094b5f910e6af.gif',
/*rain*/
'https://media.giphy.com/media/BAD9hUGYZkqPe/giphy.gif',
/*night rain*/
'http://umad.com/img/2015/6/night-rain-gif-9410-9796-hd-wallpapers.jpg',
/*thunderstorm*/
'https://media.giphy.com/media/8xY1YYpEZ4dws/giphy.gif',
/*night thunderstorm*/
'https://media.giphy.com/media/8xY1YYpEZ4dws/giphy.gif',
/*snow*/
'https://media.giphy.com/media/OdOfTkw2uVADC/giphy.gif',
/*night snow*/
'https://media.giphy.com/media/Ok928ivi56clq/giphy.gif',
/*mist*/
'https://media.giphy.com/media/LmC5rpntvJPxe/giphy.gif',
/*night mist*/
'https://media.giphy.com/media/ofrQ8FYfTD8gE/giphy.gif'
];
var imageArray = [];
for (var i = 0; i < png.length; i++) {
for (var j = 0; j < bodyImages.length; j++){
if (png[i] == weatherId) {
imageArray.push(bodyImages[j]);
$("body").css('background-image', 'url('+ imageArray[i] +')');
}
}
}
};
nikkilr88 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1424 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
nikkilr88 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:warning: nikkilr88 already gave tylermoeller points
nikkilr88 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 478 | @mot01 |http://www.freecodecamp.com/mot01
weather
is your variable for the description
weather
bigyankarki sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 479 | @mot01 |http://www.freecodecamp.com/mot01
function permAlone(str) {
var repeat = /(.)\1+/g;
if(str.match(repeat) !== null && str.match(repeat)[0] == str) return 0;
var arr = str.split('');
var permutArr = [];
var temp, position = 0, len = str.length - 1;
function permutation(position, len){
if(position == len){
permutArr.push(arr.map(function(val){return val;}).join(''));
}else{
for(var i = position; i<= len; i++){
temp = arr[i];
arr[i] = arr[position];
arr[position] = temp;
permutation(position+1,len);
temp = arr[i];
arr[i] = arr[position];
arr[position] = temp;
}
}
}
permutation(position,len);
var result = permutArr.filter(function(x){return !x.match(repeat);});
return result;
}
kbaig sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 407 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
adelmahjoub sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 298 | @kbaig |http://www.freecodecamp.com/kbaig
gustavebn sends brownie points to @skycoder01 :sparkles: :thumbsup: :sparkles:
:cookie: 64 | @skycoder01 |http://www.freecodecamp.com/skycoder01
array.sort(function(a,b){
return b-a;
});
There is an error message when I delete the word "return". But I don't want to anything to be returned for now, but I want the compare function sort from greatest to smallest number. How can I do that?