software engineering Tag Archives - General Assembly Blog

Top 5 JavaScript Interview Questions

By

JavaScript is one of the most popular programming languages. Even though there are many JavaScript-based frameworks like React.js and Node.js, the ability to answer some core JavaScript questions will always give you an upper hand during a coding interview.

So, let’s start with the top 5 JavaScript interview questions!

1. What is hoisting?

Hoisting is a default process wherein JavaScript moves all the declarations to the top of the current scope.

Example:

a=20;
console.log(a) // 20
var a;

Even though the JavaScript variable a is initialized and accessed before it’s declared, JavaScript doesn’t throw an error.

2. What is the purpose of closures?

As per MDN Web Docs,

“Closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment).” 

In simple terms, Closure is under functional programming, and it allows an inner function to access an outer function’s scope, even when the outer function has already returned.

Example:

const cartMode = function() {
    let items=[] // acts like a private variable
    function addItem(item) {
       items.push(item)
       return "Item added to Cart"
    }

    function totalItems() {
      return items.length
    }

    return {
       addItem,
       totalItems
    }

}

const cart=cartMode()
cart.addItem("Bag") // returns Item added to Cart
console.log(cart.items) // returns undefined
cart.totatItems() // returns 1

In the above example, the items variable is accessible to all the inner functions, but it’s not directly accessible from outside. This happens because of closures

3. What is the difference between let, const, and var?

Before ES6, JS had no way to support block-level scope variables. Now, we have:

  • var for creating function-level scope variables.
  • let for creating dynamic block-level scope variables.
  • const for creating constant block-level scope variables.

Example:

var a = 20

if(a > 10) {
  let b = 1
  const a = 2

  console.log(b,a, 'Inner Scope')   // 1 2 Inner Scope
}

console.log(a, 'Outer Scope')   // 20 Outer Scope

4. What is the output of the following code?

console.log("1")
setTimeout(function(){
  console.log("2")
},0)
console.log("3")

Output:

"1"
"3"
"2"

Even though we specified the delay as 0ms, it still prints “2” after “3.” This is because of the Event Loop in JavaScript. 

In this case, first, console.log(“1”) is executed, then setTimeout() is executed; after the specified delay (in this case, 0ms), the callback function is added to Message Queue. Now the main thread only picks up items from the message queue once the current execution is done. So, the main thread first evaluates the console.log(“3”) statement post. Then, it picks up the callback() from the Queue and executes the console.log(“2”) statement. Hence, the above output.

5. The Difference between arrow functions and regular functions?

Arrow functions are new ES6 syntax for defining functions. It looks like this:

const add = (a,b) => a+b
add(2,3) // 5 

The main difference between the arrow function and the regular function is the value of this keyword.

In the case of arrow functions, the keyword assigns a value lexically. What this means is unlike regular functions, arrow functions never create their own execution context. They, by default, take the execution context of the enclosing function, aka, parent. 

Here is another great article explaining this in-depth. 

Conclusion

Preparing for JavaScript Interviews can feel overwhelming, but you now know the JavaScript code, the programming language, and the scripting language; the only way to really answer an advanced JavaScript interview question is to examine things one concept at a time

Explore Coding Workshops

Portfolio Project Spotlight: Software Engineering Immersive

By

Every graduate of our Software Engineering Immersive programs gets the opportunity to work on a portfolio-grade final project. The experience gives students a chance to apply their newfound skills in programming languages and problem-solving to real-world issues and scenarios, as well as gaining invaluable insights and impactful results that they can use to stand out in their job searches.

Here are a few of our instructors’ favorites.


Save the ocean

Jiha Hwang, a visual interaction designer at Lopelos Project Group, created an app to raise ocean pollution awareness, allowing users to share tips for reducing plastic use. She used Rails, React, and PostgreSQL to build the app and deployed it with Heroku.

See the Project

FRIDGIFY

Sathya Ram and Marichka Tsiuriak, now both front-end developers, created this eater-friendly organizational tool using MongoDB, Express, React, and Node. The animated web app allows you to categorize the contents of your fridge and track their expiration dates.

See the Project

SETTLERS OF CATTAN

Bryant Cabrera, now a software engineer at Amazon, built a web-based adaptation of this popular board game. Powered by HTML, CSS, JavaScript, and jQuery, the app allows players to test their logic and negotiation skills just as they would in person.

See the Project

The Top 5 Highest-Paying Careers in Tech

By

Careers in tech

It’s no secret. Tech talent is in high demand across industries, but finding people with the skill sets to fill these roles has been challenging, causing competition amongst businesses for talent in tech — in software engineering, UX design, data science, and digital marketing. As a result, jobs in data analytics, computer science, cloud computing, software engineering, digital marketing, and others pay well.   

So what does “pay well” really mean? Using data from PayScale, Glassdoor.com, and Burning Glass’s most recent Hybrid Jobs report, we’ve put together the numbers for the most common entry level tech jobs. (Note: salary levels quoted below are for the U.S. and can vary from country to country.)
Continue reading

What It’s Really Like to Change Your Career Online

By

Going to work used to mean physically traveling to a workplace. Whether by foot, public transit, or car — a job was a specific location to which you commuted. But with the advent of the gig economy and advances in technology, telecommuting has become more and more prevalent. In fact, according to a 2018 study, approximately 70% of workers worldwide spend at least one day a week working from home.

So, why should education be any different? Learning from the comfort of home saves you the time and money you would’ve spent commuting, allows you to spend more time with loved ones, and encourages a much more comfortable, casual work environment.

That’s why we’re now offering all of our career-changing Immersives online. We’ve transformed over 11K+ careers — so whether you’re interested in becoming a software engineer, data scientist, or UX designer, you can trust our proven curriculum, elite instructors, and dedicated career coaches to set you up for professional success.

We sat down with three experts on GA’s Immersive Remote programs to better understand how they work — and more importantly — how they compare to the on-campus experience.

Breaking Barriers

GA Education Product Manager Lee Almegard explained the reasoning behind the move: “At GA, the ability to pay tuition, commute to class, or coordinate childcare shouldn’t be a barrier to launching a new career, she said. “Our new 100% remote Immersive programs are designed to ease these barriers.”

Obviously, saving yourself a trip to campus is appealing on many levels, but some interested students expressed concern that they wouldn’t receive enough personalized attention studying online as opposed to IRL. Instructor Matt Huntington reassures them, saying “Our lectures are highly interactive, and there is ample time to ask questions — not only of the teacher but also of other students.” 

Staying Focused

It’s not always easy to stay focused in a traditional classroom, but when your fellow students have been replaced by a curious toddler or Netflix is only a click away, distraction is a real concern. 

GA graduate Alex Merced shared these worries when he began his Software Engineering Immersive Remote program, but they quickly disappeared. “The clever use of Slack and Zoom really made the class engaging. It leverages the best features of both platforms, such as polls, private channels, and breakout rooms,” he said. “This kept the class kinetic, social, and engaging, versus traditional online training that usually consists of fairly non-interactive lectures over PowerPoint.”

If you’re concerned about staying focused, you can use these simple, impactful tips to stay motivated and on track to meet your goals:

  • Plan ahead. Conquer homework by blocking off time on your calendar each week during the hours in which you focus best.
  • Limit distractions. Find a quiet place to study, put your device on “Do Not Disturb” mode, or find a productivity app like Freedom to block time-consuming sites when studying or working independently.
  • Listen to music. You might find that music helps you concentrate on homework. Some of our favorite Spotify playlists to listen to are Deep Focus, Cinematic Chillout, and Dreamy Vibes.
  • Take breaks. Go for a short walk at lunch and change up the scenery, or grab a latte to power through an assignment.
  • Ask for help. We’re here for you! Our instructional team is available for guidance, feedback, technical assistance, and more during frequent one-on-one check-ins and office hours.

Most importantly, listen to yourself. Everyone learns differently, so take stock of what works best for you. Find the strategies that fit your learning style, and you’ll be well on your way to new skills and new heights. 

Getting Connected and Getting Hired

Another key component of learning is the camaraderie that comes from meeting and studying with like-minded students. How does that translate to a virtual classroom?

GA Career Coach Ruby Sycamore-Smith explains that both students and faculty can have meaningful, productive relationships without ever meeting in person. We’re a lot more intentional online,” she says. “You’re not able to just bump into each other in the corridor as you would on campus, but that means you’re able to be a lot more purposeful with your time when you do connect — way beyond a simple smile and a wave. Merced agrees. “Breakout sessions allowed me to assist and be assisted by my classmates, with whom I’ve forged valuable relationships. Now I have friends all over the world.” And as Huntington pointed out, “There is no back of the classroom when you’re online.” When you learn remotely, every seat is right next to all of your peers.

When we piloted the Software Engineering Remote bootcamp, we took extra care to make sure that our virtual classrooms felt exactly like the on-campus ones, with group labs and even special projects to ensure students are constantly working with each other,” Huntington explained. “A lot of our students form after-hours homework groups, and nighttime TAs create study hall video conferences so everyone can see and talk to each other.” 

And with students from all over the country, you’re going to connect with people you never would’ve met within the confines of a classroom. These peers could even be the very contacts who help you get you hired.

By recruiting industry professionals who are also gifted instructors to lead courses, students are taught how to translate their knowledge into in-demand skill sets that employers need. Sycamore-Smith explains that the involvement of GA’s career coaches doesn’t end after graduation; they’re invested in their students’ long-term success.

She says, “Career preparation sessions are very discussion-based and collaborative, as all of our students have varied backgrounds. Some are recent college graduates, others may have had successful careers and experienced a number of job hunts previously. Everyone has unique ideas and insights to share, so we use these sessions to really connect and learn from one another.” 

Merced is enthusiastic about his GA experience and quickly landed a great job as a developer. “Finding work was probably the area I was most insecure about going into the class,” he confessed. “But the prep sessions really made the execution and expectations of a job search much clearer and I was able to land firmly on my feet.

Conclusion? Make Yourself at Home

After years of teaching in front of a brick-and-mortar classroom, Huntington was a little wary about his move to digital instructor, but his misgivings quickly gave way. 

I was surprised to feel just as close to my virtual students as I did to my on-campus students, he said. “Closing down our virtual classrooms and saying goodbye on the last day of class is so much more heart-wrenching online than it ever was for me when I taught on campus.” 

Huntington’s advice to a student wondering if online learning is right for them: “Go for it! It’s just like in person, but there’s no commute and it’s socially acceptable to wear pajamas!”

Learn About Our Immersive Remote Programs