Skip to content

Instantly share code, notes, and snippets.

McLarenCollege /
Last active Sep 15, 2021
Set Up Instructios for Foundations Batch

Set Up Instructions

  • Complete the set up by or before the deadline mentioned in the enrollment email

  • If you have any problem in the set up you must tell us on Discord along with a clear description of the problem.

1.Set Up VSCode and Nodejs

  • Watch the video in the link to setup Github and other things and make sure to use your first and last name in your GitHub Profile.
  • Video Link


Write a function that accepts two strings and checks whether the first string is an anagram of the second string. If yes, the function returns true , else it returns false. The case(upper/lower)of the character MATTERS.

For eg.

function isAnagarm(str1,str2){
// write your code here
McLarenCollege /
Last active Aug 23, 2021
Ticket Price Child Adult

Given a person's age and a day ,write the code for the following scenario:

If the person is an Adult (age >=18) , the ticket price on Weekends is 100 and on weekdays is 80.

If the person is a child (age <18), the ticket price is always half of the adult price for that particular day.

let age = 15;
let day = "Sunday";

Given two variables age and day, write code to determine the ticket price as per the following rules :

  • For a child (age less than 12) the ticket price is always 50.

  • For a senior citizen(age greater than or equal to 65):

    i) if it is weekend (Saturday/Sunday) the price is 70.
    ii)if it is a  weekday the price is 80.
  • For everybody else the price is always 100.


A cinema is showing movie to childeren (age < 18) for free and charging adults (age >= 18) with $10 per ticket.

Write if-else statements to print the following messages according to the given age.

For adults print the following messages to the console:

Please pay $10.
Please proceed to the cinema hall.

For children print the following message to the console:


Intitialize the currentDay, currentMonth and currentYear variables with the values for the current day.

Given the details of Anu's birthday write a boolean expression to check if today is Party Time (Anu's birthday) by comparing it with the details for the current day.

let anuBirthDay = 26;
let anuBirthMonth = "August";
let anuBirthYear = 1986;

let currentDay = ; //Initialize with current Day
let currentMonth = ; //Initialize with current Month

Foundations Course Syllabus

  • Basic Data Types and Operators (String, Number, +, -)
  • Variables (Declaration, Assignment, Naming rules)
  • Compound Expressions (%, ++, --, +=)
  • Boolean data type and logical operators (or, and, not)
  • If/else and Ternary Operator
  • Functions
  • Arrays and Loops
  • Objects
  • Array and String Methods
View function_trace_3.js
// Requirements: Create a trace output file showing each function call
// including parameter values, and each return value. You should be able
// to step through with pen and paper - do not run the code on your computer
// Tip: To refresh your memory of how to write trace output, see this gist:
function foo(koo, y) {
if ((koo % 3) !== 0) {
  • Part 1 - Write a function that takes two numbers and returns the average of the two numbers.

  • Part 2 - Write a second function to calculate the average of 3 numbers by extending the code written in the first function.