body {
font-family: ‘Segoe UI’, Tahoma, Geneva, Verdana, sans-serif;
background-color: #f8f9fa;
color: #333;
line-height: 1.6;
margin: 0;
padding: 0;
}
.container {
max-width: 960px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
header {
background-color: #004a99;
color: #fff;
padding: 20px;
text-align: center;
border-radius: 8px 8px 0 0;
margin-bottom: 20px;
}
header h1 {
margin: 0;
font-size: 2.5em;
}
.calculator-section {
margin-bottom: 40px;
padding: 25px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #fdfdfd;
}
.calculator-section h2 {
color: #004a99;
margin-top: 0;
text-align: center;
margin-bottom: 25px;
}
.input-group {
margin-bottom: 20px;
text-align: left;
}
.input-group label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #555;
}
.input-group input[type=”number”],
.input-group select {
width: calc(100% – 22px);
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
box-sizing: border-box;
}
.input-group input[type=”number”]:focus,
.input-group select:focus {
border-color: #004a99;
outline: none;
box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.2);
}
.input-group .helper-text {
font-size: 0.85em;
color: #777;
margin-top: 5px;
display: block;
}
.error-message {
color: #dc3545;
font-size: 0.85em;
margin-top: 5px;
display: none;
font-weight: bold;
}
.button-group {
text-align: center;
margin-top: 25px;
}
button {
background-color: #004a99;
color: white;
padding: 12px 25px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1em;
margin: 0 10px;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #003366;
}
button.reset-button {
background-color: #6c757d;
}
button.reset-button:hover {
background-color: #5a6268;
}
button.copy-button {
background-color: #28a745;
}
button.copy-button:hover {
background-color: #218838;
}
.results-section {
margin-top: 30px;
padding: 25px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #f0f8ff;
}
.results-section h2 {
color: #004a99;
margin-top: 0;
text-align: center;
margin-bottom: 25px;
}
.primary-result {
font-size: 2.2em;
font-weight: bold;
color: #004a99;
text-align: center;
margin-bottom: 20px;
padding: 15px;
background-color: #e6f2ff;
border-radius: 5px;
border: 1px solid #b3d9ff;
}
.intermediate-results div {
margin-bottom: 10px;
font-size: 1.1em;
color: #333;
}
.intermediate-results span {
font-weight: bold;
color: #004a99;
}
.formula-explanation {
font-size: 0.95em;
color: #555;
margin-top: 15px;
padding: 10px;
background-color: #f8f9fa;
border-left: 3px solid #004a99;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
margin-bottom: 20px;
}
th, td {
padding: 10px;
text-align: left;
border: 1px solid #ddd;
}
th {
background-color: #004a99;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
caption {
font-size: 1.1em;
font-weight: bold;
color: #004a99;
margin-bottom: 10px;
caption-side: top;
text-align: left;
}
.chart-container {
text-align: center;
margin-top: 30px;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #fdfdfd;
}
.chart-container h2 {
color: #004a99;
margin-top: 0;
margin-bottom: 20px;
}
#woodWeightChart {
max-width: 100%;
height: auto;
}
.article-section {
margin-top: 40px;
padding: 25px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #fff;
}
.article-section h2, .article-section h3 {
color: #004a99;
margin-bottom: 15px;
}
.article-section h2 {
text-align: center;
margin-top: 0;
}
.article-section p, .article-section ul, .article-section ol {
margin-bottom: 15px;
}
.article-section ul, .article-section ol {
padding-left: 20px;
}
.article-section li {
margin-bottom: 8px;
}
.faq-item {
margin-bottom: 15px;
}
.faq-item strong {
color: #004a99;
display: block;
margin-bottom: 5px;
}
.internal-links {
margin-top: 30px;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #f0f8ff;
}
.internal-links h3 {
color: #004a99;
margin-top: 0;
text-align: center;
margin-bottom: 20px;
}
.internal-links ul {
list-style: none;
padding: 0;
text-align: center;
}
.internal-links li {
margin-bottom: 10px;
}
.internal-links a {
color: #004a99;
text-decoration: none;
font-weight: bold;
}
.internal-links a:hover {
text-decoration: underline;
}
.internal-links p {
font-size: 0.9em;
color: #555;
margin-top: 5px;
}
.highlight {
background-color: #fff3cd;
padding: 2px 5px;
border-radius: 3px;
}
.primary-keyword {
font-weight: bold;
color: #004a99;
}
Calculate Amount of Weight for Wood
Your essential tool for estimating wood weight accurately.
Wood Weight Calculator
Oak
Pine
Maple
Walnut
Cedar
Custom
Select a common wood type or choose ‘Custom’ to enter your own density.
Enter the density of your wood in kg/m³ (e.g., 600 for Oak).
Enter the volume of the wood in cubic meters (m³).
Enter the moisture content of the wood (e.g., 12%). Higher moisture increases weight.
Calculation Results
This formula calculates the total weight by multiplying the wood’s volume by its density and then adjusting for the added weight due to moisture content.
Weight vs. Moisture Content
What is Wood Weight Calculation?
Calculating the amount of weight for wood is a fundamental process in many industries, from construction and furniture making to shipping and forestry. It involves determining the total mass of a piece of wood based on its physical dimensions (volume) and its inherent property of density, further adjusted for its moisture content. Understanding the amount of weight for wood is crucial for accurate material estimation, structural integrity assessments, transportation logistics, and cost management. Whether you’re a carpenter estimating lumber needs for a project or a homeowner planning a deck, knowing how to calculate amount of weight for wood ensures efficiency and prevents costly errors.
Who should use it?
Professionals in construction, architecture, woodworking, furniture design, logging, shipping, and even DIY enthusiasts undertaking home improvement projects can benefit from accurately calculating wood weight. It’s also useful for researchers studying material properties.
Common misconceptions:
A frequent misconception is that all wood of the same species weighs the same. However, moisture content significantly impacts wood’s weight. Another is assuming density is solely dependent on species; drying processes and wood treatments can also alter it. Many also underestimate the substantial increase in weight due to high moisture levels.
Wood Weight Formula and Mathematical Explanation
The core principle behind calculating the amount of weight for wood is the relationship between mass, volume, and density. Density is defined as mass per unit volume. However, wood’s weight is not static; it changes considerably with its moisture content. Therefore, a comprehensive formula must account for these factors.
The formula we use is:
Weight = Volume × Density × (1 + Moisture Content / 100)
Let’s break down the variables:
| Variable | Meaning | Unit | Typical Range |
|---|---|---|---|
| Volume (V) | The total space occupied by the wood. | Cubic Meters (m³) | 0.01 m³ to 100+ m³ |
| Density (ρ) | The mass of the wood per unit volume, typically measured at a standard moisture content (e.g., 12%). | Kilograms per Cubic Meter (kg/m³) | 300 kg/m³ (Balsa) to 1200 kg/m³ (Lignum Vitae) |
| Moisture Content (MC) | The amount of water present in the wood, expressed as a percentage of the oven-dry weight. | Percent (%) | 0% (oven-dry) to 100%+ (waterlogged) |
| Weight (W) | The total mass of the wood, including the effect of moisture. | Kilograms (kg) | Varies greatly based on inputs. |
Mathematical Explanation:
The base weight of the wood is calculated by multiplying its Volume by its Density (W_base = V × ρ). This gives the weight of the wood if it were at its standard reference moisture content (often assumed to be 12% for construction lumber).
However, wood is hygroscopic, meaning it absorbs and releases moisture from the surrounding environment. Water is significantly heavier than wood fiber. Therefore, we need to adjust the base weight to account for the actual Moisture Content. The term (1 + MC / 100) acts as a multiplier. For example, if the moisture content is 12%, the multiplier is (1 + 12/100) = 1.12. This means the wood will weigh 12% more than its oven-dry equivalent due to the absorbed water. If the wood is oven-dry (MC=0%), the multiplier is 1, and the weight is simply Volume × Density. This adjustment is critical for accurate estimations, especially when dealing with wood that has been exposed to varying humidity levels or has undergone specific drying processes.
Practical Examples (Real-World Use Cases)
Understanding how to calculate amount of weight for wood is best illustrated with practical scenarios.
Example 1: Estimating Lumber for a Deck Frame
A contractor is building a deck frame and needs to estimate the weight of the pressure-treated pine lumber required. They estimate needing approximately 2.5 cubic meters of lumber. The specific gravity (related to density) of pressure-treated pine at around 15% moisture content is roughly 550 kg/m³.
- Volume: 2.5 m³
- Wood Type: Pressure-Treated Pine
- Density: 550 kg/m³
- Moisture Content: 15%
Calculation:
Weight = 2.5 m³ × 550 kg/m³ × (1 + 15 / 100)
Weight = 1375 kg × (1 + 0.15)
Weight = 1375 kg × 1.15
Weight = 1581.25 kg
Interpretation: The contractor can estimate that the total weight of the pine lumber for the deck frame will be approximately 1581.25 kg. This information is vital for planning transportation (e.g., ensuring the delivery truck can handle the load) and for structural considerations if the deck is being built over a sensitive area. This calculation helps in understanding the amount of weight for wood needed.
Example 2: Calculating Weight for a Custom Furniture Piece
A furniture maker is crafting a large dining table from solid oak. They have calculated the total volume of oak required to be 0.8 cubic meters. The oak is kiln-dried to a standard 10% moisture content. The density of oak at 12% moisture content is approximately 720 kg/m³. Since the wood is slightly drier (10% MC), we can use this value directly or slightly adjust the density if more precision is needed, but for simplicity, we’ll use the provided density and the actual MC.
- Volume: 0.8 m³
- Wood Type: Oak
- Density: 720 kg/m³
- Moisture Content: 10%
Calculation:
Weight = 0.8 m³ × 720 kg/m³ × (1 + 10 / 100)
Weight = 576 kg × (1 + 0.10)
Weight = 576 kg × 1.10
Weight = 633.6 kg
Interpretation: The total weight of the oak for the dining table is estimated to be 633.6 kg. This is important for the furniture maker to understand the handling requirements during construction and finishing, as well as for informing the client about the substantial weight of the finished piece. This demonstrates how to calculate amount of weight for wood for specific applications.
How to Use This Wood Weight Calculator
Our Wood Weight Calculator is designed for simplicity and accuracy. Follow these steps to get your weight estimation:
- Select Wood Type: Choose your wood species from the dropdown menu (e.g., Oak, Pine, Maple). If your wood type isn’t listed, select ‘Custom’.
- Enter Custom Density (if applicable): If you selected ‘Custom’, input the specific density of your wood in kilograms per cubic meter (kg/m³). You can usually find this information from your lumber supplier or online resources.
- Input Volume: Enter the volume of the wood you are working with in cubic meters (m³). Ensure your measurements are accurate.
- Specify Moisture Content: Enter the moisture content of the wood in percentage (%). This is a critical factor as wet wood is significantly heavier than dry wood.
- Click ‘Calculate Weight’: Once all fields are filled, click the button.
How to read results:
The calculator will display:
- Total Weight: The primary result, shown in kilograms (kg). This is your estimated total weight.
- Density: The density value used in the calculation (either selected or custom).
- Volume: The volume you entered.
- Moisture Adjustment Factor: The multiplier used to account for moisture content.
Decision-making guidance:
Use the calculated weight to:
- Plan transportation and lifting equipment.
- Verify material quantities for projects.
- Assess structural load capacities.
- Estimate shipping costs.
- Compare the weight implications of different wood species for your project.
The amount of weight for wood is a key parameter in many logistical and structural decisions.
Key Factors That Affect Wood Weight Results
Several factors influence the calculated weight of wood. Understanding these helps in refining your estimations and interpreting the results:
- Wood Species: Different species have inherently different densities due to their cellular structure and composition. Hardwoods like Oak and Maple are generally denser and heavier than softwoods like Pine and Cedar. This is the primary determinant of base weight.
- Moisture Content: This is arguably the most variable factor. Wood absorbs moisture from the air, and water is heavy (1000 kg/m³). A piece of wood at 20% moisture content will weigh significantly more than the same piece at 8% moisture content. Proper drying and storage are key.
- Volume and Dimensions: The sheer size of the wood piece directly impacts its total weight. A larger volume naturally means more mass, assuming consistent density and moisture. Accurate measurement of length, width, and height is essential.
- Wood Treatments: Processes like pressure treatment (for preservation) can sometimes add a small amount of weight due to the chemicals infused into the wood, although the primary effect is preservation rather than significant weight addition.
- Wood Defects and Inclusions: Knots, cracks, or the presence of resin pockets can slightly alter the local density and, consequently, the overall weight. However, for large volumes, these effects are often averaged out.
- Temperature: While less significant than moisture, temperature can cause slight expansion or contraction of wood, subtly affecting its volume and density. However, this effect is usually negligible for practical weight calculations.
- Grain Structure: Variations in grain patterns and density within the same piece of wood can occur. Straight-grained wood might have a more uniform density compared to highly figured or wavy-grained wood.
Accurate estimation of the amount of weight for wood requires careful consideration of these variables.
Frequently Asked Questions (FAQ)
The density of wood varies greatly by species. Softwoods like Pine typically range from 350-550 kg/m³, while hardwoods like Oak can range from 600-900 kg/m³. Balsa wood is exceptionally light (around 100-150 kg/m³), while dense tropical hardwoods like Lignum Vitae can exceed 1200 kg/m³. Our calculator uses typical values, but custom input is recommended for precision.
Moisture content significantly increases wood weight. Water has a density of 1000 kg/m³. As wood absorbs water, its weight increases proportionally. For example, wood at 20% moisture content is considerably heavier than the same wood at 10% moisture content. This is why specifying moisture content is crucial for accurate amount of weight for wood calculations.
Yes, kiln-dried wood generally weighs less because it has a lower moisture content than air-dried wood. Kiln drying removes more moisture in a controlled environment, resulting in a lighter, more stable product.
For irregularly shaped wood, you can approximate the volume by breaking it down into simpler geometric shapes (cubes, cylinders, prisms) and summing their volumes. Alternatively, water displacement methods can be used for smaller, solid pieces, though this is less practical for large lumber. For lumber, measuring length, width, and average thickness is standard.
This calculator works with cubic meters (m³). Board feet are a unit of volume commonly used in North America for lumber. To use this calculator with board feet, you first need to convert board feet to cubic meters. 1 board foot ≈ 0.00236 m³. Multiply your board footage by 0.00236 to get the volume in m³.
Density is mass per unit volume (e.g., kg/m³). Specific gravity is the ratio of the wood’s density to the density of water (1000 kg/m³). Specific gravity is dimensionless. Often, wood density values are given relative to a specific moisture content (e.g., 12% MC).
The default densities are average values for common wood types at a typical moisture content (around 12%). Actual density can vary based on the specific growing conditions, part of the tree, and drying process. For critical applications, using a measured density or consulting precise wood data tables is recommended.
The calculator primarily focuses on weight based on current volume and moisture. Wood does shrink as it dries. If you are calculating the weight of green lumber that will later be dried, the final volume and weight will be less. The calculator assumes the volume entered is the volume for which you want to calculate the weight at the specified moisture content.
Related Tools and Internal Resources
-
Wood Density Guide
Explore a comprehensive list of wood densities for various species.
-
Lumber Conversion Calculator
Convert between different units of lumber measurement like board feet and cubic meters.
-
Wood Moisture Calculator
Understand how moisture content affects wood properties and how to measure it.
-
Construction Cost Estimator
Estimate the overall costs for various construction projects, including material weights.
-
Timber Volume Calculator
Calculate the volume of standing timber or logs.
-
Wood Shrinkage Calculator
Estimate the dimensional changes (shrinkage) of wood as it dries.
var woodDensities = {
oak: 720,
pine: 510,
maple: 690,
walnut: 660,
cedar: 370,
custom: 600
};
var currentDensity = woodDensities[‘oak’];
function updateDensity() {
var woodTypeSelect = document.getElementById(‘woodType’);
var selectedType = woodTypeSelect.value;
var customDensityGroup = document.getElementById(‘customDensityGroup’);
var customDensityInput = document.getElementById(‘customDensity’);
if (selectedType === ‘custom’) {
customDensityGroup.style.display = ‘block’;
currentDensity = parseFloat(customDensityInput.value) || 600;
} else {
customDensityGroup.style.display = ‘none’;
currentDensity = woodDensities[selectedType];
}
updateChart(); // Update chart when density changes
calculateWeight(); // Recalculate weight immediately
}
function validateInput(inputElement, min, max) {
var errorElementId = inputElement.id + ‘Error’;
var errorElement = document.getElementById(errorElementId);
var value = parseFloat(inputElement.value);
if (isNaN(value)) {
errorElement.textContent = ‘Please enter a valid number.’;
errorElement.style.display = ‘block’;
inputElement.value = inputElement.getAttribute(‘value’) || ”; // Reset to previous valid or default
return false;
}
if (value max) {
errorElement.textContent = ‘Value cannot be greater than ‘ + max + ‘.’;
errorElement.style.display = ‘block’;
inputElement.value = max; // Set to maximum allowed value
return false;
}
errorElement.textContent = ”;
errorElement.style.display = ‘none’;
return true;
}
function calculateWeight() {
var volumeInput = document.getElementById(‘volume’);
var moistureContentInput = document.getElementById(‘moistureContent’);
var customDensityInput = document.getElementById(‘customDensity’);
var volumeError = document.getElementById(‘volumeError’);
var moistureContentError = document.getElementById(‘moistureContentError’);
var customDensityError = document.getElementById(‘customDensityError’);
var isValid = true;
if (!validateInput(volumeInput, 0.01, Infinity)) isValid = false;
if (!validateInput(moistureContentInput, 0, 100)) isValid = false;
if (document.getElementById(‘woodType’).value === ‘custom’ && !validateInput(customDensityInput, 1, 1500)) isValid = false;
if (!isValid) {
document.getElementById(‘totalWeightResult’).textContent = ‘– kg’;
document.getElementById(‘densityResult’).innerHTML = ‘Density: — kg/m³’;
document.getElementById(‘volumeInM3Result’).innerHTML = ‘Volume: — m³’;
document.getElementById(‘moistureAdjustmentResult’).innerHTML = ‘Moisture Adjustment Factor: –‘;
return;
}
var volume = parseFloat(volumeInput.value);
var moistureContent = parseFloat(moistureContentInput.value);
var density = (document.getElementById(‘woodType’).value === ‘custom’) ? parseFloat(customDensityInput.value) : woodDensities[document.getElementById(‘woodType’).value];
if (isNaN(density)) { // Fallback if custom density is not a number
density = 600;
customDensityInput.value = 600;
document.getElementById(‘customDensityError’).textContent = ”;
document.getElementById(‘customDensityError’).style.display = ‘none’;
}
currentDensity = density; // Update global currentDensity
var moistureAdjustmentFactor = 1 + (moistureContent / 100);
var totalWeight = volume * density * moistureAdjustmentFactor;
document.getElementById(‘totalWeightResult’).textContent = totalWeight.toFixed(2) + ‘ kg’;
document.getElementById(‘densityResult’).innerHTML = ‘Density: ‘ + density.toFixed(0) + ‘ kg/m³’;
document.getElementById(‘volumeInM3Result’).innerHTML = ‘Volume: ‘ + volume.toFixed(2) + ‘ m³’;
document.getElementById(‘moistureAdjustmentResult’).innerHTML = ‘Moisture Adjustment Factor: ‘ + moistureAdjustmentFactor.toFixed(2);
updateChart();
}
function resetCalculator() {
document.getElementById(‘woodType’).value = ‘oak’;
document.getElementById(‘customDensity’).value = ‘600’;
document.getElementById(‘volume’).value = ‘1’;
document.getElementById(‘moistureContent’).value = ’12’;
document.getElementById(‘customDensityGroup’).style.display = ‘none’;
document.getElementById(‘volumeError’).textContent = ”;
document.getElementById(‘volumeError’).style.display = ‘none’;
document.getElementById(‘moistureContentError’).textContent = ”;
document.getElementById(‘moistureContentError’).style.display = ‘none’;
document.getElementById(‘customDensityError’).textContent = ”;
document.getElementById(‘customDensityError’).style.display = ‘none’;
updateDensity(); // This will also call calculateWeight()
}
function copyResults() {
var totalWeight = document.getElementById(‘totalWeightResult’).textContent;
var density = document.getElementById(‘densityResult’).textContent.replace(‘Density: ‘, ”);
var volume = document.getElementById(‘volumeInM3Result’).textContent.replace(‘Volume: ‘, ”);
var moistureFactor = document.getElementById(‘moistureAdjustmentResult’).textContent.replace(‘Moisture Adjustment Factor: ‘, ”);
var assumptions = “Assumptions:\n”;
assumptions += “Wood Type: ” + document.getElementById(‘woodType’).options[document.getElementById(‘woodType’).selectedIndex].text + “\n”;
if (document.getElementById(‘woodType’).value === ‘custom’) {
assumptions += “Custom Density: ” + document.getElementById(‘customDensity’).value + ” kg/m³\n”;
}
assumptions += “Moisture Content: ” + document.getElementById(‘moistureContent’).value + “%\n”;
var resultText = “Wood Weight Calculation Results:\n”;
resultText += “Total Weight: ” + totalWeight + “\n”;
resultText += “Density: ” + density + “\n”;
resultText += “Volume: ” + volume + “\n”;
resultText += “Moisture Adjustment Factor: ” + moistureFactor + “\n\n”;
resultText += assumptions;
// Use a temporary textarea to copy text
var textArea = document.createElement(“textarea”);
textArea.value = resultText;
textArea.style.position = “fixed”;
textArea.style.left = “-9999px”;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand(‘copy’);
var msg = successful ? ‘Results copied to clipboard!’ : ‘Failed to copy results.’;
// Optionally show a temporary message to the user
console.log(msg);
} catch (err) {
console.log(‘Unable to copy results.’, err);
}
document.body.removeChild(textArea);
}
// Charting Logic
var chart;
var woodWeightChartCanvas = document.getElementById(‘woodWeightChart’);
function updateChart() {
var ctx = woodWeightChartCanvas.getContext(‘2d’);
if (chart) {
chart.destroy(); // Destroy previous chart instance
}
var volume = parseFloat(document.getElementById(‘volume’).value) || 1;
var density = currentDensity; // Use the globally updated currentDensity
var baseMoisture = parseFloat(document.getElementById(‘moistureContent’).value) || 12;
var moistureLevels = [];
var weights = [];
// Generate data for chart (e.g., from 0% to 30% moisture)
for (var mc = 0; mc <= 30; mc += 2) {
moistureLevels.push(mc);
var factor = 1 + (mc / 100);
var weight = volume * density * factor;
weights.push(weight);
}
chart = new Chart(ctx, {
type: 'line',
data: {
labels: moistureLevels.map(function(mc) { return mc + '%'; }),
datasets: [{
label: 'Estimated Weight (kg)',
data: weights,
borderColor: '#004a99',
backgroundColor: 'rgba(0, 74, 153, 0.1)',
fill: true,
tension: 0.1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
title: {
display: true,
text: 'Moisture Content (%)'
}
},
y: {
title: {
display: true,
text: 'Weight (kg)'
},
beginAtZero: true
}
},
plugins: {
legend: {
position: 'top',
},
title: {
display: true,
text: 'Wood Weight vs. Moisture Content'
}
}
}
});
}
// Initial setup
document.addEventListener('DOMContentLoaded', function() {
updateDensity(); // Set initial density based on default selection
calculateWeight(); // Calculate initial weight
updateChart(); // Draw initial chart
});
// Simple Chart.js library inclusion (for demonstration purposes, in a real app, you'd include this in )
// In a production environment, you would link to the Chart.js library externally.
// For this single-file output, we’ll assume Chart.js is available globally.
// If running this standalone, you’d need to add:
//
// in the section.
// For this exercise, we assume it’s available.