Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- var sum = [4,5,6,7];
- function sumNested(sum) {
- var num;
- for(var i = 0; i<sum.length;i++){
- num = num + i;
- }
- return num;
- }
- var string = "hello world";
- var example = "This is a short sentence!"
- function wordCount(sentence){
- var word = sentence.split(" ");
- return word.length;
- }
- function areTheseAnagrams(str1, str2) {
- if (str1.length !== str2.length) {
- return false;
- }
- var str1Count = {};
- Array.prototype.forEach.call(str1, function(ch) {
- str1Count[ch] = str1Count[ch] ? 1 + str1Count[ch] : 1;
- });
- var str2len = str2.length;
- for (var i = 0; i < str2len; i++) {
- if(!str1Count[str2[i]]) {
- return false;
- } else {
- str1Count[str2[i]] -= 1;
- }
- }
- return true;
- }
- function Car(
- speed: 0;
- getSpeed: function getSpeed() {return speed;};
- setSpeed:function setSpeed(number) {
- if(speed === 0){
- return number;
- };
- stop: function stop() {
- if(number !== 0){
- return 0;
- }
- }
- function fizzBuzz(n) {
- var string = "";
- if( n <= 0){
- return "";
- } else {
- for(var index = 0; index<=n;index++ ){
- if(index > 0){
- console.log(index)
- }
- else if (index%3===0){
- console.log(index+"fizz");
- }
- else if(index%5===0){
- console.log(index+"buzz");
- }
- else if ((index%3===0) && (index%5===0)){
- console.log(index+"fizzbuzz");
- }
- string = string + index
- return string;
- }
- }
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">var sum = [4,5,6,7];
- function sumNested(sum) {
- var num;
- for(var i = 0; i<sum.length;i++){
- num = num + i;
- }
- return num;
- }
- var string = "hello world";
- var example = "This is a short sentence!"
- function wordCount(sentence){
- var word = sentence.split(" ");
- return word.length;
- }
- function areTheseAnagrams(str1, str2) {
- if (str1.length !== str2.length) {
- return false;
- }
- var str1Count = {};
- Array.prototype.forEach.call(str1, function(ch) {
- str1Count[ch] = str1Count[ch] ? 1 + str1Count[ch] : 1;
- });
- var str2len = str2.length;
- for (var i = 0; i < str2len; i++) {
- if(!str1Count[str2[i]]) {
- return false;
- } else {
- str1Count[str2[i]] -= 1;
- }
- }
- return true;
- }
- function Car(
- speed: 0;
- getSpeed: function getSpeed() {return speed;};
- setSpeed:function setSpeed(number) {
- if(speed === 0){
- return number;
- };
- stop: function stop() {
- if(number !== 0){
- return 0;
- }
- }
- function fizzBuzz(n) {
- var string = "";
- if( n <= 0){
- return "";
- } else {
- for(var index = 0; index<=n;index++ ){
- if(index > 0){
- console.log(index)
- }
- else if (index%3===0){
- console.log(index+"fizz");
- }
- else if(index%5===0){
- console.log(index+"buzz");
- }
- else if ((index%3===0) && (index%5===0)){
- console.log(index+"fizzbuzz");
- }
- string = string + index
- return string;
- }
- }
- </script></body>
- </html>
Add Comment
Please, Sign In to add comment