Coder Social home page Coder Social logo

extra-basic-javacript-2's Introduction

/* Basics */

/*Write a program that logs ‘Hello World’ to the screen.*/
//code here
/*Write a program that asks the user for their name and greets them with their name. (Use prompt)*/
//code here
/*Modify the previous program such that only the users Alice and Bob are greeted with their names.*/
//code here
/*Write a program that asks the user for a number n and prints the sum of the numbers 1 to n*/
//code here
/*Modify the previous program such that only multiples of three or five are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17*/
//code here
/*Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1,…,n. (use prompt)*/
//code here
/*Write a program that prints a multiplication table for numbers up to 12. (1 * 1 = 1; 1*2 = 2 ... 1*2 = 2...)*/
//code here
/*Write a program that prints all prime numbers. (Note: if your programming language does not support arbitrary size numbers, printing all primes up to the largest number you can easily represent is fine too.)*/
//code here
/*Write a guessing game where the user has to guess a secret number. After every guess the program tells the user whether their number was too large or too small. At the end the number of tries needed should be printed. It counts only as one try if they input the same number multiple times consecutively.*/
//code here
/*Write a program that prints the next 20 leap years.*/
//code here

/* Arrays */

/*Write a function that returns the largest element in a array.*/
// code here
/*Write function that reverses a array, preferably in place.*/
// code here
/*Write a function that takes a number and returns a array of its digits. So for 2342 it should return [2,3,4,2].*/
// code here
/*Write a function that checks whether an element occurs in a array.*/
// code here
/*Write a function that returns the elements on odd positions in a array.*/
// code here
/*Write a function that computes the running total an array containing numbers.*/
// code here
/*Write a function on_all that applies a function to every element of a array. Use it to print the first twenty perfect squares. The perfect squares can be found by multiplying each natural number with itself. The first few perfect squares are 1*1= 1, 2*2=4, 3*3=9, 4*4=16. Twelve for example is not a perfect square because there is no natural number m so that m*m=12. (This question is tricky if your programming language makes it difficult to pass functions as arguments.)*/
// code here
/*Write a function that concatenates two arrays. [a,b,c], [1,2,3] → [a,b,c,1,2,3]*/
// code here
/*Write a function that combines two arrays by alternatingly taking elements. You may assume the arrays are always of equal length., e.g. [a,b,c], [1,2,3] → [a,1,b,2,c,3].*/
// code here
/*Write a function that rotates a array by k elements. For example [1,2,3,4,5,6] rotated by two becomes [3,4,5,6,1,2]. */
// code here
/*Write a function that computes the array of the first 100 Fibonacci numbers. The first two Fibonacci numbers are 1 and 1. The n+1-st Fibonacci number can be computed by adding the n-th and the n-1-th Fibonacci number. The first few are therefore 1, 1, 1+1=2, 1+2=3, 2+3=5, 3+5=8.*/
// code here

extra-basic-javacript-2's People

Contributors

jtonneyck avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.