diff --git a/app.js b/app.js new file mode 100644 index 0000000..2b1ca20 --- /dev/null +++ b/app.js @@ -0,0 +1,24 @@ +var NodeBuzz = require('sea-d44-fizz-buzz-zg'); + + +document.getElementById("button-b").addEventListener("submit", function (e) { + e.preventDefault(); + + // instantiated my new NodeBuzz function. + var myfizz = new NodeBuzz('bleep', 'blorp'); + + // Assigning the input values to variables. + aVal = parseInt(document.getElementById("min").value); + zVal = parseInt(document.getElementById("max").value); + myfizz.input(aVal, zVal); + + // Creating and appending DOM elements with processed inputs + document.getElementById("DOM-elements").innerHTML=""; + var newEl = document.createElement("p"); + var newtext = document.createTextNode(myfizz.output(this.result)); + newEl.appendChild(newtext); + document.getElementById("DOM-elements").appendChild(newEl); +}); + + + diff --git a/app2.js b/app2.js new file mode 100644 index 0000000..0b634e6 --- /dev/null +++ b/app2.js @@ -0,0 +1,32 @@ +var FizzBuzz = (function () { + var aVal, zVal; + + var _fizzbuzz = function(newString1, newString2) { + this.newString1 = newString1 || "Fizz"; + this.newString2 = newString2 || "Buzz"; + }; + + _fizzbuzz.prototype = { + input: function (aVal, zVal) { + this.result =[]; + for ( aVal ; aVal <= zVal; aVal ++) { + if (aVal % 5 === 0 && aVal % 3 === 0) { + this.result.push(this.newString1+this.newString2); + } else if ( aVal % 3 === 0) { + this.result.push(this.newString1); + } else if (aVal % 5 === 0) { + this.result.push(this.newString2); + } else { + this.result.push(aVal); + } + } + return this.result; + }, + output: function(){ + return this.result; + } + } + + return _fizzbuzz; + +}()); diff --git a/bundle.js b/bundle.js new file mode 100644 index 0000000..45f0ed3 --- /dev/null +++ b/bundle.js @@ -0,0 +1,65 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o + + + Zach Gordon + + + + + +
+
+

FizzBuzz Assignment

+
+ + + +
+
+
+
+ + + diff --git a/node_modules/sea-d44-fizz-buzz-zg/README.md b/node_modules/sea-d44-fizz-buzz-zg/README.md new file mode 100644 index 0000000..9ebcd00 --- /dev/null +++ b/node_modules/sea-d44-fizz-buzz-zg/README.md @@ -0,0 +1,22 @@ +# fizzbuzz-redux__W5-A4 + +Tonight's assignment: refactor your FizzBuzz into a library and publish it to the npm registry. + +You will first refactor the object to have an `input` and an `output` method, instead of the "read" and "write" methods. + +Just like last night's homework, your constructor should accept arguments that change the strings "Fizz" and "Buzz" (e.g. `new FizzBuzz('Bleep', 'Blorp')`). The `input` method should accept two arguments, `min` and `max`—you may safely assume they are `Numbers`. `output` does not take any arguments, but _must_ return an array. + +Your module should expose a function using the CommonJS `module.exports` construct. I should be able to `npm install ` and use it like so: + +``` +var FizzBuzz = require(''); + +var buzzer = new FizzBuzz(); // Should accept string arguments that replace 'Fizz' and 'Buzz' +buzzer.input(1, 120); + +console.log(buzzer.output()); +``` + +Name your module `sea-d44-fizz-buzz-` and publish it to the npm registry. And, as usual, fork this repo and submit a PR. + + diff --git a/node_modules/sea-d44-fizz-buzz-zg/index.js b/node_modules/sea-d44-fizz-buzz-zg/index.js new file mode 100644 index 0000000..b944a62 --- /dev/null +++ b/node_modules/sea-d44-fizz-buzz-zg/index.js @@ -0,0 +1,36 @@ +var FizzBuzz = (function () { + var aVal, zVal; + + var _fizzbuzz = function(newString1, newString2) { + this.newString1 = newString1 || "Fizz"; + this.newString2 = newString2 || "Buzz"; + }; + + _fizzbuzz.prototype = { + input: function (aVal, zVal) { + this.result =[]; + for ( aVal ; aVal <= zVal; aVal ++) { + if (aVal % 5 === 0 && aVal % 3 === 0) { + this.result.push(this.newString1+this.newString2) + } else if ( aVal % 3 === 0) { + this.result.push(this.newString1); + } else if (aVal % 5 === 0) { + this.result.push(this.newString2); + } else { + this.result.push(aVal); + } + } + return this.result; + }, + output: function(){ + return this.result; + } + } + + return _fizzbuzz; + +}()); + +module.exports = FizzBuzz + + diff --git a/node_modules/sea-d44-fizz-buzz-zg/package.json b/node_modules/sea-d44-fizz-buzz-zg/package.json new file mode 100644 index 0000000..d2f0bda --- /dev/null +++ b/node_modules/sea-d44-fizz-buzz-zg/package.json @@ -0,0 +1,31 @@ +{ + "name": "sea-d44-fizz-buzz-zg", + "version": "1.0.3", + "description": "First attempt at making a node module library to be published.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/ZachKGordon/fizzbuzz-redux__W5-A4.git" + }, + "keywords": [ + "sea-d44" + ], + "author": { + "name": "Zach Gordon", + "email": "z.gordon.h@gmail.com" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/ZachKGordon/fizzbuzz-redux__W5-A4/issues" + }, + "homepage": "https://github.com/ZachKGordon/fizzbuzz-redux__W5-A4", + "readme": "# fizzbuzz-redux__W5-A4\n\nTonight's assignment: refactor your FizzBuzz into a library and publish it to the npm registry.\n\nYou will first refactor the object to have an `input` and an `output` method, instead of the \"read\" and \"write\" methods.\n\nJust like last night's homework, your constructor should accept arguments that change the strings \"Fizz\" and \"Buzz\" (e.g. `new FizzBuzz('Bleep', 'Blorp')`). The `input` method should accept two arguments, `min` and `max`—you may safely assume they are `Numbers`. `output` does not take any arguments, but _must_ return an array.\n\nYour module should expose a function using the CommonJS `module.exports` construct. I should be able to `npm install ` and use it like so:\n\n```\nvar FizzBuzz = require('');\n\nvar buzzer = new FizzBuzz(); // Should accept string arguments that replace 'Fizz' and 'Buzz'\nbuzzer.input(1, 120);\n\nconsole.log(buzzer.output());\n```\n\nName your module `sea-d44-fizz-buzz-` and publish it to the npm registry. And, as usual, fork this repo and submit a PR.\n\n\n", + "readmeFilename": "README.md", + "gitHead": "de054b2493c5091a08f61c016cb8fd3de3e36339", + "_id": "sea-d44-fizz-buzz-zg@1.0.3", + "_shasum": "ee9315c4f10a76664c11529fef461b4491bb83f6", + "_from": "sea-d44-fizz-buzz-zg@*" +} diff --git a/style.css b/style.css new file mode 100644 index 0000000..68ea36e --- /dev/null +++ b/style.css @@ -0,0 +1,8 @@ +.FizzBuzz-container h1{ +color: #09C; +} + +.FizzBuzz-container li{ +list-style-type: none; +} +