Pages

Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Thursday, March 17, 2016

SHOW THE LOCAL WEATHER - PROJECT



  • Objective: The objective here is to build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/bELRjV.

  • The rules are as follows:-

    #1: Don't look at the example project's code. I have to figure it out myself.
    #2: I have to fulfill the following user stories. I am free to use whichever libraries or APIs and look of the App as well

    The user stories are given as:-

    #1: User should we able to view his current weather condition.
    #2: User should we able to see a different icon or background image (e.g. snowy mountain, hot desert) depending on the weather.
    #3: User should be able to push a button to toggle between Fahrenheit and Celsius.

    I used the Open Weather API to build this app. I had to struggle a little bit with ajax queries and toggling of the temperature into Fahrenheit and Celsius.

    I don't think this is a perfect App, but I will try to improve it as I learn more and have more experience with web development.

    So here is my version of the Show The Local Weather App. Please check it out by clicking on the embedded version.

    See the Pen Show the Local Weather by Bhagwant Singh (@sagit2002) on CodePen.

    Tuesday, March 8, 2016

    WHERE DO I BELONG

    This challenge requires returning the lowest index at which a value  that is second argument should be inserted into an array which is the first argument after sorting it.

    The algorithm was quite straight forward, only thing that made me to think was what if the number is to inserted at index greater than last index of the array e.



    Friday, March 4, 2016

    FALSY BOUNCER

    In this challenge we have to remove all falsy values from an array.

    Falsy values in JavaScript are:-

     false, null, 0, "", undefined, and NaN.

    For this challenge I went through the clues that are given in the form of clickable links above, again leading to MDN JavaScript documentation.

    Then on with little bit of tweaking I was able to implement the under-mentioned solution for the challenge.

    So, here is my solution.

                    function bouncer(arr) {
                 function Boolean(value){
                     var i = 0;
                     arr1 = [NaN, 0, false, null, undefined];
                     if (arr1[i] === value){
                         i++;
                     } 

                     return value;
                 }
                 return arr.filter(Boolean);
               }

    Thursday, March 3, 2016

    MUTATIONS

    This Challenge requires to return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

    For example, ["hello", "Hello"], have to return true because all of the letters in the second string are present in the first, after ignoring case.
    The arguments ["hello", "hey"] should have to return false because the string in first element "hello" does not contain a "y".

    Similarly, ["Alien", "line"], should be returning true because all of the letters in "line" are there in "Alien".

    Wednesday, March 2, 2016

    SLASHER FLICK

    In this challenge I have to return the remaining elements of an array after chopping off n elements from the head.

    The head means the beginning of the array, or the zeroth index.

    CHUNKY MONKEY

    Challenge this time is to write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensional array.