Blueyedgeek's Posts
Nairaland Forum › Blueyedgeek's Profile › Blueyedgeek's Posts
1 2 3 4 5 6 7 8 9 10 11 12 (of 15 pages)
{{var bump = true}} |
pcguru1:cool. What is a transpiler? Are they the same as preprocessors? |
Nmeri17:Nope or do you mean that the function will be called as a method on the array? |
Nmeri17:I don't understand PS1. PS2: len is just another variable to hold and cache the length of the array passed in, good for performance (if we have an array of say 50,000 items, it only has to search for the length once and not 50,000 times). |
Nmeri17:Okay, that should give me a workout and light no dey make I test for pc. I will try it out when I have access to a system. I still think yours isn't working because of the parameter ish. Edit: This should work, Create a function that accepts one parameter. Create a locally scoped variable inside the function, it should be an empty array. Loop through the passed in array (passed as an argument) For each time the loop executes, the last item in the passed in array should be passed in to the temporary array as a first item. Return the temporary array and it will have the reversed form of the passed in array. Should look like this
|
Nmeri17:First off, there is a reverse method defined on Array.prototype that does this easily. A very simple reverse array function would look like this,
Now to your question, your function is supposed to be passed an argument and it is that argument that the body of your function should work on. So pass in a parameter and it is that parameter that you manipulate inside the body of your function. |
DAvIt0:cool, built any application with it before? Also, where do you stand on meteor js, just read about it on javascriptissexy.com, sounds exciting. |
Nmeri17:I'll check it when I'm on pc but I'm quite sure it should work. Morning. |
Nmeri17:Trust me, it's refreshing. |
@nmeri17, you should also sign up for an account on codewars.com Social network for programmers (na code challenges full there ooo). |
Nmeri17:well you assigned a property 'push' and passed the function range as the result and so it returns an array containing the function (I'm just guessing, I haven't tested it.) A simpler way to write this would be
|
Nmeri17:Cool by me. I'll try my best to answer any questions you might have and also be ready to answer mine too ooo. Regarding the odin project, I want to follow their guide and I wanted to know if you are interested. We could skip the html and css section and start with the javascript and continue from there. |
Nmeri17:Yeah, I'm game. Side note: Ever heard of the odin project before? |
Nmeri17:I'm still learning oo, so many things to learn sef. The learning never really stops. |
Nmeri17:Lemme attempt 1 and 3. I don't fully understand question 2. 1. The charAt method simply stands for 'character at', from this break down, you know the method is used to return a character at a specific position in a string. You could also use array notation [] on a string and it would do the same thing. Use case: var myName = "Blueyedgeek"; The indexOf method returns the index position of a particular string. Use case: var myName = "Blueyedgeek"; The difference is in the arguments passed, charAt expects a number while indexOf expects a string. 3. The remove function takes two arguments, the array to act on and an index position (this should have been named stop if you ask me) to stop. When an array is passed in, the slice method is called on the array with a starting position of 0 and a stop position of anything passed to index. (0,0) should return the first item in the array. The array is then concatenated with a slice of the array starting at the stop position with an addition of one. I guess this isn't clear enough. Please ignore syntax errors, I'm on phone Let me try again, when the remove function is called with those arguments passed in, (a,b,c,d,e) and 2, the function first takes a slice of the array starting at position 0 (note that slice doesn't change the state of an array, it only returns a new modified array). Position 0 is "a", the stop position is 2. Note that the stop position isn't returned in the modified array. So let's break down what the function does in stages. It first returns a slice of the array with a stop position as specified by the argument passed in. The remove function is called with a stop position of 2 so calling (a,b,c,d,e).slice(0,2) will return a and b (note it doesn't return the item at the stop position). Now we have a and b. The function then calls concat on a slice of the array starting at the stop position plus one. When the slice method is called with only one argument, it returns everything from that position to the end of the array. So calling (a,b,c,d,e).slice(2 + 1) , 2 + 1 is 3. Let's rewrite to make it clearer (a,b,c,d,e).slice(3) will return d and e. Now we have a, b from the first operation and d , e from the second. The remove function concatenates these two arrays into one by calling the concat method. Concatenate is simply big word for join. Let's call the concat method on our values a, b, d , e. This returns (a,b,d,e). Hope this is clear I'll attempt two when I have a better understanding of closures. |
Bump... |
DAvIt0:Cool, how does it compare with Angularjs since you have said it is used as just the 'V' in the MVC architecture. Isn't angularjs a full mvc-ish framework? |
DAvIt0:Cool, lemme check them out. Which do you use? |
Nmeri17:I'm still a learner oooo. There are just so many things to learn and I keep learning everyday. I've barely even scratched the surface and I don't think I've attained the mastery I seek. well sha I hope you're still available to help. I'll be grateful if u can refer to that book's page 75. the codes from that page down to the end of the chapter is making me lose touch with realityI wouldn't get to hung up if I were you. Take your time to re - read the chapter and re - read it until it becomes clear. If that doesn't help, skip the chapter and read other chapters and then after getting a better understanding you can go back to the chapter again. You know what, how about we both read the chapter again and on Saturday / Sunday, we come here to discuss the chapter thoroughly and iron out every issue, sounds good? |
tundex32:Yipee!! Thou art remembered us. Great. Two questions: * with the sweeping changes coming to angularjs in version 2.0, is it advisable to invest time in learning the framework? * Which other JavaScript framework out there would you say is a viable alternative to angularjs? |
The o.p has definitely forgotten about this thread. Uncool |
Let's start implementing some of the suggestions that have been posited on this thread in the little way we can. |
malvisguy212:Thanks for your time as well. Go preach somewhere else, if God himself shows up here, he might end up an atheist. |
Jregz:We still dey learn oo but yes JavaScript is a language I like very much (first love and all). |
malvisguy212:How about, * There is no verifiable proof of the existence of deities * God refuses to show up during the world cup final for the whole world to see and believe * Gods in general only exist as long as there are believers, I'm pretty sure Zeus and the Greek gods died when people stopped believing in them. * God only exists in the mind of those that believe. I stopped believing and he stopped existing. The angel Lucifer fellAren't you the least bit surprised as to what brought about this change in Lucifer? Seems like God's plan from the beginning was flawed. Also, puny Lucifer almost overthrew his creator and was also able to convince one third of the angels to side with him, something must have been very wrong with God's way of ruling his angels. People only rebel when they have been wronged. Think about that, your God didn't have a perfect rule and so the angels rebelled. Also, God f****ing set Adam and Eve to fail, could have at least warned them about the latest developments in his perfect heaven where there is no war. The tactic is clear: firstly, question God’shorse**** no one seeks equality with something that exists in the mind of believers only. This satanic deception appeals stronglyYou think that's what this is all about but you are very wrong. We are simply being honest with our selves and not clinging to a lie all in a bid to go to perfect heaven where angels fight wars like humans I tell you the truth, I have encounter God ,long before I even became a Christian I have seen Jesus saved me in my dream.God's there.Not surprised and I believe you. God is probably too afraid to show himself to atheists as they would probably be too much for him to handle |
Beginning to wonder if the females I see here are really females because I no dey see una for real life. |
Jregz:yeah, just noticed it. Thanks for pointing that out. |
fingard02k:Awa shi n learn. I wouldn't say I'm into any language per se as I try to learn as many as possible but as of now, I have gotten very comfortable with HTML, CSS, (not programming languages but very important) Sass(a css preprocessor and a superset of css) and JavaScript (programming language). I've decided to pick up Python as my backend language of choice because..... well, it's awesome. I'll also learn PHP as well because.... well, it's PHP, everyone is expected to know it. Daz all. |
Today is 22nd by the way so you are one day behind schedule. |
Great! Please try as much as possible to make it as interactive as possible (Answer my stupid questions, give exercises, help us work on little projects that will improve our knowledge etc...) Signing up for the class. |
Let me try to clear up some things for you. HTML is a markup language (not a programming language) and it is the bedrock of any web application. It has a very simple syntax and is very easy to learn. All web pages on the internet at their core are simply HTML documents. PHP on the other hand is a server side programming language used to (permit to say) add 'smarts' to your HTML documents. Let me give you an example to further clarify: Look at the source code of this page (if you don't know how to do this, all you have to do is right click anywhere on the page and select 'view page source' or 'view source' depending on the browser.) At the very top you should see something like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> That ugly looking stuff is called the doctype declaration (the newer syntax is simply <!DOCTYPE html> ) , it is used to inform the browser that the html document follows the specified standards and that the resulting page should be rendered in something known as the standards mode. Ignoring nairaland's messy looking html tags, a simple html document looks like this:
As you can see, with html, you are just basically declaring stuff. Think back to using word processors, when you want to structure documents, you have a heading and some paragraphs. Sometimes you make text bold to show importance, other times you italicize text to create emphasis. The same thing can be done with html, only this time, you are not just working with text, you are building full blown web pages. Now, with html, everything is all good and dandy, but after sometime you realise that your web pages are just static. You create them and they just stare right back at you doing nothing of importance. Think back to when God created Adam and he was just mud, to make Adam do stuff, he was given the breath of life. In order to give your html document life, you activate it with a server side language like PHP. There are other server side languages but PHP (which you want to learn) is a good choice and is beginner friendly. A simple php script looks like this (I no too sabi PHP ooo): <?php echo 'Hello World, this is a string in an awesome php script' ?> To summarise, HTML alone is used to create static pages but in order to build dynamic sites like Nairaland, Facebook, Gmail, Youtube then you have to activate your web page with a server side language. Finally, you absolutely have to learn HTML but in order to build dynamic web pages then you absolutely need a server side language. Pata pata pata, learn both. |
ps3o:Cool, something like that has been done here before and I think it was discontinued because of the reward parts. It will be better if the problems are presented for people to solve so that they can improve on their skills without necessarily getting any reward, learning in and of itself is a reward. |




yu should know this question
those guys ain't joking at all 

I was surprised u didn't mention it in yo recommended books to download