Managing Dates with Javascript Date Formats

Javascript date formats are notoriously quirky — they are a critical part of many websites, but they’re difficult to implement correctly in a cross-browser fashion — and have caused developers many headaches. The Javascript standard provides three different formats for Javascript dates, and each format has different uses.

Some variations in Javascript dates happen simply because of the browser you use, especially when adding a specific time. Developers need to be aware that the same code handling a date can work differently on different browsers. This is less of a problem in modern browsers but some irregularities still remain.

This article will go over the various types of Javascript date formats and why Javascript has a preferred format for both dates and times. Then, we will examine the quirks that browsers present when working with these formats.

Continue Reading

How To Read From a File in C++

In your programming journey, there will come a time when you’ll want to start working with real-world data. This kind of data is typically stored in files on disk. Since reading from files involves interacting with your operating system, it amounts to a rather complex task. In this article, we’ll look at C++ streams, file handling, and three different methods for reading data from a file into a C++ program. 

If you come from a high-level programming language like Python, reading a file into a program seems like a simple enough task. You open the file, read its contents and close it. Working with a file might take up one or two lines of your code. In C++, the workflow of reading a file is a bit more complex — there is the added step of reading to or from a stream object. To understand how our C++ programs interact with files, let us now take a look at the concept of streams in C++. 

Continue Reading

How To Print in C++

Most coding revolves around inputting data into something like an integrated development environment (IDE) to create a program that accomplishes a task. However, you’ll likely need that program to output data at some point. In this guide, we’ll look at how to print text in C++, covering ways to print a string and best format them.

What Is a String?

A C++ string is a variable that stores a sequence of characters, usually representing a word or phrase. We can call upon this variable later for use in our program by using the string command. If we’re looking to output a string, we can type the string we want to print directly into our program without first storing it as a variable. Here is an example:

Continue Reading

C++ Sets Explained

Think of your favorite sports team. All of its players are unique and we can order them by their jersey numbers. We can refer to the players directly by name or by their number. 

A similar concept exists in programming: We can organize a set number of unique values based on a predetermined order. In C++, this type of data structure is called a set.

In this article, we’ll explore what C++ sets are and how to use them, before presenting scenarios in which we would and would not use sets. 

What Is a Set in C++?

A set is a data structure that stores unique elements of the same type in a sorted order. Each value is a key, which means that we access each value using the value itself. With arrays, on the other hand, we access each value by its position in the container (the index). Accordingly, each value in a set must be unique. 

Continue Reading

How to Build a CSS Dropdown Menu

Navigation within a website is one of the most important aspects of design. Showing where the navigation is and  presenting it in an easy-to-use method is a combination that can be tricky without the right tools. 

Thankfully, CSS has various options for just that issue. In this short tutorial, you will learn how to create a CSS dropdown menu.

A wonderful aspect of CSS is how much it lets you explore your creative concepts while providing useful HTML page design. There are some common elements of a CSS dropdown menu used across the board. 

However, that does not mean all CSS dropdown options have to be the same. In fact, they don’t all even have to be menus.

Continue Reading

Javascript Hub: Strategies to Create Dynamic Web Pages

Javascript is a vital part of dynamic content on the modern web. From simple scripts to complex interactions that require frameworks, Javascript enhances user experiences on the web.

There are two major types of Javascript, and this Udacity Javascript hub covers both. The first type is “vanilla” Javascript, scripts you can write using the basic rules in the Javascript standard. The second type is framework-driven Javascript that creates complex content building upon others’ frameworks, like Angular and React or libraries like FusionCharts.

This Javascript hub contains easy-to-follow guides on a wide range of Javascript topics. Most articles provide sample code to demonstrate how Javascript works in the real world.

This hub is meant to be a comprehensive resource, so we will add new content as it’s published. Check back here for more Javascript content.

Continue Reading