Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Calculate Grains on a given square on a chessboard js

//Calculate Grains on a given square on a chessboard
const totalGrains = 2 ** 64 - 1;

const grainsOn = (input) => {
  const grainCount = 2 ** (input - 1);
  return grainCount;
};
console.log(`Grains on 6th square: ${grainsOn(6)}`);
console.log(`Total grains on the Chess Board: ${totalGrains}`);
Comment

PREVIOUS NEXT
Code Example
Javascript :: list-react-files 
Javascript :: private class members javascript 
Javascript :: The slice reducer for key "books" returned undefined during initia 
Javascript :: Edit todo list react-redux 
Javascript :: vue block other script event listeners 
Javascript :: typeof regex 
Javascript :: create immutable array in javascript 
Javascript :: express plus es5 
Javascript :: reactjs ES6 class event listeners in jsx 
Javascript :: Admobs For Ios 
Javascript :: string to number javascript shortcut 
Javascript :: change to a constant variable 
Javascript :: shopify hover effect 
Javascript :: javascript stopped working 
Javascript :: <xsl:apply-templates select node text subnodes all 
Javascript :: javascript executes a script ________ 
Javascript :: to see all function attribute and methods in javascript 
Javascript :: express pass data between middleware 
Javascript :: my code agly because alot of if and else dev community 
Javascript :: strapi extend user model 
Javascript :: Uncaught TypeError: document.getElementsByClassName(...).style is undefined 
Javascript :: change teh value of a slider p5js 
Javascript :: after storing array array state is empty 
Javascript :: if conprimido js 
Javascript :: Example code of using inner blocks in Wordpress with ESNext 
Javascript :: selected item from dropdownlist 
Javascript :: vuejs jitsi 
Javascript :: get src vanilla js 
Javascript :: How do you convert VARCHAR to TIMESTAMP 
Javascript :: how to remove comma from toString function javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =