Back in the Flash days (I'm not that old, really) we would call the first class that is run when your application starts up the document class. In was common to call this class Main.as or just the name of your project with dot as after it. The language didn't force you to use any specific file name, but it didn't give any special treatment to any name in particular either. Well, in Node.js the creators have blessed us with some special features of a Javascript file named index.js. The name and function is similar to html's index.html as the main html file for a page.
0 Comments
Link: https://www.myfonts.com/WhatTheFont/
Do you ever wish that you could upload an image of some text, and have a program tell you what font the author used to write the text? Well, that's exactly what WhatDaFont is! Just upload an image and it will suggest some fonts for you! Remember, the last class definition wins! This post is going to be short and straight to the point! Freecodecamp.com said it best in one of their css challenges, "It doesn't matter which order the classes are listed in the HTML element. However, the order of the class declarations in the <style> section are what is important. The second declaration will always take precedence over the first." This means that if you have multiple classes for the same html element. Here's a quick example of this in action. Below, we set the css class on the <h1> element to blue-text and pin-text. The order there doesn't matter at all. What does matter is that in the style (note: inline css is for learning purposes only) the class blue-text is defined after the class pink-text. The same principle apples when defining multiple css files. You must declare them each in a <script> tag, and if properties are defined in more than one class then the <script> tags further down will override those above them. I like this site a lot because it is a much more interactive way to learn HTML and Javascript than most other sites. Instead of just a static page of text or a simple video file, this site is built in Javascript and is itself a simplified code editor. The lessons are called challenges, and you have to get the code correct to beat the challenge. Here's a screenshot:
This tip works for many languages, and it’s not explicitly stated all the time when starting out. I had already known that you could do this, but kudos to the book “Javascript & JQuery” by Jon Duckett for inspiring me to write a post about it. It’s a very colorful and friendly book that is actually read fun to read which is a huge accomplishment for a book about programming. Anyway, this is a useful little tip to remember when crafting your functions.
Let’s think about the function signature in different (statically typed) languages. Remember, the compile breaks out of the function when return method is called, and nothing after it is run. The function defines a return type, and to a naive programmer looking at the signature it seems that one can only return a single thing. And it’s true- you can only return one thing. But, that thing can be an Object or an Array. |
AuthorThe posts on this site are written and maintained by Jim Lynch. About Jim...
Categories
All
Archives
March 2023
|