Giter VIP home page Giter VIP logo

assignment--js-iteration-basics's Introduction

JS Iteration Basics

The Assignment

The purpose of this assignment is to improve your understanding and develop your skills with iteration, one of the foundational concepts of programming and software development. For these exercises, you will need to use for-loops to arrive at the correct solution.

You are not to use helper methods like.split() , substr(), .reverse(). The goal is to learn how to manage iteration manually to solve problems.

Setup

# (1) Go to your  muktek/assignments directory and create the `js-iteration-basics` folder for this assignment
cd ~/muktek/assignments
mkdir assignment--js-iteration-basics
cd assignment--js-iteration-basics


# (2) Download the assignment-files with curl from the assignment repo and unzip
curl https://raw.githubusercontent.com/muktek/assignment--js-iteration-basics/master/assignment-files.zip > assignment-files.zip

unzip assignment-files.zip

Instructions

The goal of these exercises is to write the logic in the function to solve the problem. The statements/declarations in the console.assert(...) describe the expected output from the function when provided with a given input and should evaluate to true if you have written the function correctly.

Here is how you will answer each exercise:

(1) Read the problem

(2) Look at the expected output

  • you instructors have written these console.assert() statements to ensure that you have written the exercise function correctly

(3) Write the function and the logic

// ++ (1) The problem :

/**
 * makeArrayFromCharacters()
 *
 * Write a function called `makeArrayFromCharacters` that takes
 *  a string and creates an array of characters for each element.
 *
 * You must use a for-loop to solve this problem.
 **/


// ++ (3a) Write the function...
function makeArrayFromCharacters(someString){
  // ++  (3b)   Example solution
  var charactersArray = []
  for(var i = 0; i < someString.length; i++){
    charactersArray.push(someString[0])
  }

  return charactersArray

}


// --------------- Don't Touch ------------------

// ++ (2a) Check the expected behavior
let output1 = makeArrayFromCharacters('hello')
console.assert( output1[0] === 'h' )
console.assert( output1[1] === 'e' )
console.assert( output1[2] === 'l' )
console.assert( output1[3] === 'l' )
console.assert( output1[4] === 'o' )
// => in other words, output1 should be ['h','e','l','l','o']

// ++ (2b)
let output2 = makeArrayFromCharacters('sunshine')
console.assert( output2[0] === 's' )
console.assert( output2[1] === 'u' )
console.assert( output2[2] === 'n' )
console.assert( output2[3] === 's' )
console.assert( output2[4] === 'h' )
console.assert( output2[5] === 'i' )
console.assert( output2[6] === 'n' )
console.assert( output2[7] === 'e' )
// => in other words, output2 should be ['s','u','n','s','h','i','n','e']

// ++ (2c)
let output3 = makeArrayFromCharacters('burrito')
console.assert( output2[0] === 'b' )
console.assert( output2[1] === 'u' )
console.assert( output2[2] === 'r' )
console.assert( output2[5] === 't' )
// => in other words, output3 should be ['b','u','r','r','i','t','o']

assignment--js-iteration-basics's People

Contributors

ipotro avatar tphdev avatar

Watchers

 avatar  avatar

assignment--js-iteration-basics's Issues

ex-01

  • ex-01-arrayToString.js:26 Uncaught ReferenceError: sugArr is not defined
    at ex-01-arrayToString.js:26

ex- 04 y ex-09

Ambos ejercicios son de makeAcronym y los resultados del test en pantalla no funcionan correctamente.

ex-08

  • A todos los console asserts les falta un paréntesis ")" al final.

scripts

  • El numero de los ejercicios de los scripts es diferente al de los ex-.js
  • GET file:///Users/Angelique/Documents/muktek/assignments/js-iteration-basics/ex-04-makeAcronym.js
    makeAcronym es ex-09-makeAcronym.js
  • makeAcronym esta repetido en 04 y 09
  • Falta el script de removeVowels
  • ex-01-arrayToString.js:32 Uncaught ReferenceError: coolArr3 is not defined
    at ex-01-arrayToString.js:32
  • en main.test.js no se llama a la función makeAcronym

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.