How to use joints?

I've tried to use the documentation and I've used many tutorials and I can't get two bodies to generate a joint between them. Here is my code:

var swordWeld = new b2DistanceJointDef();

swordWeld.bodyA = this.shape.body;
swordWeld.bodyB = this.sword;
swordWeld.length = 5;
swordWeld.localAnchorA = this.shape.body.GetWorldCenter();
swordWeld.localAnchorB = this.sword.GetWorldCenter();
var joint = world.CreateJoint(swordWeld);

I've also tried the following:

swordWeld.Initialize(this.shape.body, this.sword, this.shape.body.GetWorldCenter());

Why won't the joint appear?

EDIT: I've gotten the joint to appear for one second after loading, then it vanishes...
What do you mean by 'appear'? This code will not draw anything for you. If you are using the debug draw, remember to enable the flag to draw joints.
Is this Javascript? What port? Does that port actually have weld joints implemented?
Okay, I've enabled joints to be drawn using debug draw. The problem still persists: The two objects are not being welded together. Yes, I'm using Javascript and the latest port of Box2DWeb. According to the documentation, it supports joints.

Original thread: https://box2d.org/forum/viewtopic.php?t=9955